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

500 on /pages/api/index.js on Zeit Now #8111

Closed
guillaumervls opened this issue Jul 25, 2019 · 1 comment · Fixed by #8112
Closed

500 on /pages/api/index.js on Zeit Now #8111

guillaumervls opened this issue Jul 25, 2019 · 1 comment · Fixed by #8112
Assignees
Milestone

Comments

@guillaumervls
Copy link

Bug report

Describe the bug

You get a 500 with code in /pages/api/index.js but not if you put the same code in /pages/api/foo.js

To Reproduce

Put the following code in /pages/api/index.js:

export default (req, res) => {
  res.setHeader('Content-Type', 'application/json');
  res.statusCode = 200;
  res.end(JSON.stringify({ name: 'Nextjs' }));
};

Deploy to Now, and go to deployment.endpoint/api, you'll get a 500 (complaining that res.setHeader is not a function).

Hope I'm not missing something. Cheers!

@Timer Timer added this to the 9.0.3 milestone Jul 25, 2019
ijjk pushed a commit to ijjk/next.js that referenced this issue Jul 25, 2019
This fixes the problem with `/pages/api/index.js` not creating serverless function. Fixes vercel#8111
@huv1k huv1k closed this as completed Jul 26, 2019
@balazsorban44
Copy link
Member

This issue has been automatically locked due to no recent activity. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.

@vercel vercel locked as resolved and limited conversation to collaborators Jan 31, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants