Skip to content
Advertisement

Tag: openweathermap

Have checked countless times and can’t figure out where my error is: Uncaught TypeError: Cannot read properties of undefined (reading ‘lat’)

I’ve been playing around with the OpenWeatherMap API to learn to code and have run into a series of TypeError issues popping up in my console. My assumption is that my program is attempting to use data from the API before it is finished fetching, but I have set the fetch functions up to wait until receiving a response to

Can’t access API-key from .env-file

We are having problem accessing the API-key from our .env file when trying to fetch in our server.js. If we add the API-key manually to the URL in server.js it works, so the problem seems to be the connection between server.js and .env-file. We have npm installed dotenv. In the .env file we have written the key like this: WEATHER_API_KEY

Advertisement