Proxy API doesn't work in vercel
I following this video https://www.youtube.com/watch?v=J4E5uYz5AY8 from @manniL / TheAlexLichter and I have this [...].ts file inside server/api folder
The proxy is working on local env and I just figured out when I deploy the apps using Vercel, I got the 404 when I hit the endpoint.
I also already set the env variable in Vercel same as my local env
Alexander Lichter
YouTube
The BEST way to proxy your API in Nuxt
β‘οΈ Proxying routes to your back-end or third party APIs is a common practice! Over the last two years, various strategies came up in Nuxt. But not all of them work equally will. To figure out which two strategies are the recommended ones, we have a look at the four most common strategies, their shortcomings and which ones I would recommend to us...
8 Replies
What env variable do you set and how does your nuxt config looks like?
Here is my runtimeConfig in nuxt.config.ts
my env
And how do you deploy to Vercel?
these settings? (default)
I just deployed https://github.com/manniL/alexander-lichter-proxy-nuxt to https://alexander-lichter-proxy-nuxt.vercel.app/
Works as expected I'd say
GitHub
GitHub - manniL/alexander-lichter-proxy-nuxt
Contribute to manniL/alexander-lichter-proxy-nuxt development by creating an account on GitHub.
Hi, I opened this issue again, the previous issue on Vercel was running successfully, the problem was because I set the wrong env variable there π
The another issue is when my devops try to deploy to the dev server env using AWS Apprunner and use this "yarn dev" command start. The proxy is not working, I tried to use Proxy routeRule and Nitro proxy API endpoint but I always got this 500 error
My [...].ts
My runtime config
Note:
- It works in my local and vercel.
- Already ask my devops but no luck π¦
- My API has a healtcheck url https://api.someurl.org/api/healthcheck
- So if the proxy URL is working, I should be able to access it by https://myfrontend.org/api/healthcheck
which node version?
Node 18