Skip to content

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

@guillaumervls

Description

@guillaumervls

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!

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions