ucf-senior-design / senior-design

Senior Design Capstone Project: Fall 2022 - Spring 2023
https://we-tinerary.vercel.app
6 stars 2 forks source link

error when creating the weather widget #242

Open Nin3s opened 1 year ago

Nin3s commented 1 year ago

“Application error: a client-side exception has occurred (see the browser console for more information).”

this also broke my trip so it will not load for me anymore as of rn :[

aamare1001 commented 1 year ago

image Just added weather to a new trip and currently working. will keep trying things to see when it stops

Nin3s commented 1 year ago

image

Just added weather to a new trip and currently working. will keep trying things to see when it stops

wait didn't it originally show the current forecast + the next 5 days 🤔

aamare1001 commented 1 year ago

Not sure, but i just did a trip for Topeka Kansas and the weather widget doesn't work, i wonder if there's a patterns with the locations

aamare1001 commented 1 year ago
image

Currently getting a 401 unauthorized error when accessing weather on deployment https://openweathermap.org/faq#error401

image
aamare1001 commented 1 year ago

Works on localhost, but only on American destinations, when i use an international location the api returns 'No City found'

Nin3s commented 1 year ago

Works on localhost, but only on American destinations, when i use an international location the api returns 'No City found'

Is it possibly an issue with the google places api? Ik locations like london work if I put it in the weather api url directly, but rn it's taking in the trip destination as the parameter to search for

aamare1001 commented 1 year ago

You're right it does work on london, I think the issue may be in how the trip destination is written.

So far, if it's a simple city, American State, Country(in American place's case) or city, Country(in London's case) it works, but if it's international like Sydney in Australia, (https://api.openweathermap.org/data/2.5/weather?q=Sydney NSW, Australia&appid=8958736f2360ef82e976ec83c5d1537d&units=imperial) it returns city not found

aamare1001 commented 1 year ago

https://api.openweathermap.org/data/2.5/weather?q=Sydney NSW, Australia&appid=8958736f2360ef82e976ec83c5d1537d&units=imperial

vs

https://api.openweathermap.org/data/2.5/weather?q=Sydney,NSW,Australia&appid=8958736f2360ef82e976ec83c5d1537d&units=imperial

It looks like the space is what messes with the request(after q=)

aamare1001 commented 1 year ago

Going to just remove the space from the link now that it works on production

aamare1001 commented 1 year ago

Linked branch with this issue,

Now it checks if there is an error state and produces an error message. Also for international destinations, we take out the middle of the destination(Quebec, qc, Canada -> Quebec, Canada) in the api call for the weather. there is still a niche error with this when it comes to destinations that don't separate the first two words with a common(Sydney NSW, Australia) as the API does not recognize this, and simply taking out spaces would mess with other destinations such as Altamonte Springs, Fl, USA or would simply try and search or SydneyNSW. An idea to fix this would be to go by zip code but for now the widget will show the error message that the weather information could not be loaded to avoid crashing.

Nin3s commented 1 year ago

Linked branch with this issue,

Now it checks if there is an error state and produces an error message. Also for international destinations, we take out the middle of the destination(Quebec, qc, Canada -> Quebec, Canada) in the api call for the weather. there is still a niche error with this when it comes to destinations that don't separate the first two words with a common(Sydney NSW, Australia) as the API does not recognize this, and simply taking out spaces would mess with other destinations such as Altamonte Springs, Fl, USA or would simply try and search or SydneyNSW. An idea to fix this would be to go by zip code but for now the widget will show the error message that the weather information could not be loaded to avoid crashing.

there is a separate api link that lets us use the zipcode of the city, but we will have to convert the city into that which I'm not really sure I know how to do atm