Uploadthing returning 502 error

I have been using uploadthing for a while on my website. Astro hosted on Netlify. It's all been working well! In the last couple of days, I am suddenly getting 502 errors. Here is a link to my form: https://www.fizzkidz.com.au/careers/ To try and fix it, I upgraded from 7.6.0 to 7.7.2 and the react plugin from 7.3.0 to 7.3.1 but still seeing the same issue. I have not made any changes to uploadthing. My last change was migrating to v7 a few months ago and all has been working well until this issue appeared. Running locally everything works fine. Can anyone help me understand and solve this? If I go directly to the route that hosts my uploadthing route handler, I am also seeing a crash: https://www.fizzkidz.com.au/api/uploadthing Thank you !
3 Replies
.361 °
.361 °3mo ago
@safman It seems env problem. Try to check env variables on netlify.
safman
safmanOP3mo ago
Thanks @.361 ° as it turns out - this form was a client component, and astro requires environment variables used in client components to be prefixed with "PUBLIC_". So updating my env variables to "PUBLIC_UPLOADTHING_TOKEN" fixed. very strange as it was all working perfectly well before. 🤷‍♂️
.361 °
.361 °3mo ago
In astro, it keep secrets from leaking, it will only replace variables whose names begin with PUBLIC_; everything else is stripped out.

Did you find this page helpful?