-
Notifications
You must be signed in to change notification settings - Fork 86
API route as Netlify function 502s #296
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Please check this solution: #115 (comment) |
Sorry, not sure what this has to do with |
@omarryhan do you have a build command set in the UI? i see the github repo you linked doesnt have a netlify.toml aka the other place where it could be set, like so: [build]
command = "npm run build" |
Under a NX workspace, how I should define build command? |
@vitorcamachoo under the article you linked on your own issue (we should prob move this conversation there): |
No @lindsaylevine. The only thing I have set in the UI is that I added the plugin.
There used to be one, but I removed it. I thought |
I added it. Now the static files are deployed correctly but the functions aren't. Link to the most recent deployment: https://app.netlify.com/sites/trendzz/deploys/609ca9a36003565c0101970a Link to the website: https://trendzz.netlify.app |
@omarryhan ah that should fix it for you! i'd love feedback for our docs/README about how to make it clearer that every netlify site needs a build command specified somewhere! |
oh oops i didn't see your second comment one sec |
i'm confused what exactly is the problem with your functions? |
This is from my dev console: I'm confused too. Not sure what's causing the Bad Gateway error. Maybe because the Netlify's Edge servers aren't actually running the function? The same function runs fine on Vercel (https://trendzz.vercel.app/api/repositories?language=) |
@lindsaylevine I think it'd be better if users didn't need to to manually add the build command in either the UI or netlify.toml. However, I'll be happy to make a PR highlighting this caveat :) |
do you see the function in your site's functions tab? if so what do the logs say? :) |
quickest way for me to diagnose is to set up a repo that reproduces it tho! |
Yes, it's there. It also picked up my request when I tried to trigger a function call from the website. Here are the logs:
And this is the endpoint: https://trendzz.netlify.app/.netlify/functions/next_api_repositories |
can you get me a repo that reproduces this? i have no idea why this'd work on vercel but effectively time out on netlify 🤔 |
The repo is open source: https://github.com/omarryhan/trendzz Or would you like me to recreate the issue in a new repo? |
omg it was in the original post hahaha sorry i need to sleep lmao. will look asap!!! |
I speculate that the problem has to do with how the functions are being deployed by Netlify. Netlify is probably expecting the functions to be in the Should I try and see if changing that fixes it? |
No problem 😄. Tyt |
@omarryhan if you take out the |
i can confirm now this definitely works for me. why? i'm not quite sure at the moment 😄 but definitely something to do with our compat layer and possibly related to #190 |
It worked! Thanks a lot for the help. |
@omarryhan hahah i was sure it was something unique to your config but nope! hope you enjoyed my commit names :D. such a random thing. if/when i figure out the res.end weirdness ill try to remember to report back here. thanks for your patience and help!! |
* chore: cache fixtures * chore: also rebuild on changes to prepare.mjs
Describe the bug
Plugin internal error when deploying a serverless Next.js app on Netlify.
The error is: Error: No static assets found in .next dist (aka no /.next/static).
Full error message:
To Reproduce
I first did nothing but install the plugin from Netlify's UI.
Then it showed me an info message in the deployment logs that I should set the
target
property in next.config.js to be eitherserverless
orexperimental-serverless-trace
. I set it toserverless
.It then showed me the error posted above.
Link to the app: https://github.com/omarryhan/trendzz/
Link to the failed deployment: https://app.netlify.com/sites/trendzz/deploys/609b8568b7933100072efaad
Expected behavior
Deploy without an error.
Versions
The text was updated successfully, but these errors were encountered: