Skip to content
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

API routes in NextJS don't return any data #861

Open
ekasprzyk opened this issue Aug 15, 2024 · 2 comments
Open

API routes in NextJS don't return any data #861

ekasprzyk opened this issue Aug 15, 2024 · 2 comments
Assignees

Comments

@ekasprzyk
Copy link

We've just tried moving from Serverless Components to SST for the deployment of our disposable branch environments and we're trying to replace that with SST before we think about moving the main site over.

We've had a lot of luck getting our site working on SST, but there's one thing that is behaving a bit weird that we just can't figure out. Not sure if this is a bug or just a documentation/concept error or whatever. So I'll just ask our question here as I haven't been able to find any information on it at all.

We have a NextJS 12.x site which we deploy via serverless components. That deploy uses Cloudfront and has an s3 bucket with default and API lambdas attached to it.

We've tried redeploying the same thing with SST and it's worked, mostly. We can see the site, some content even loads. We're nearly there. But, for reasons we don't understand, the `/api' routes are not returning data. We can see the routes being called in logs, we can see the current status being returned (e.g. one of our routes returns 500 due to a misconfiguration we haven't fixed, and that's correct, others return correct 200s). But no JSON. No data is being returned.

When trying to understand it a bit better, we notice that there is no longer an API lambda in the deployment, but that everything goes through the default lambda and we think that's normal based on the diagram of the system architecture.

Any advice on what we're doing wrong? And if so, any documentation that could be written to help others (assuming we're not being idiots)?

Also, we're noticing there aren't any edge functions that we can obviously tell in Cloudfront, and don't know if we have some issues with that as well.

@jayair
Copy link
Contributor

jayair commented Aug 22, 2024

I wonder about Next 12 in this case.

You can try asking the https://open-next.js.org repo, or #open-next in our Discord as well.

@ekasprzyk
Copy link
Author

@jayair Thanks. I've asked the OpenNext community!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants