vercel-wasm-runtime icon indicating copy to clipboard operation
vercel-wasm-runtime copied to clipboard

Nextjs /pages/api doesn't work

Open YuriGor opened this issue 3 years ago • 1 comments

Hi, I am trying to adopt this example in my nextjs project and once I am adding /api to the root of project - it works, but /pages/api stops working. Moving all the /pages/api to /api is not an option - it doesn't work properly (nextjs api work differently then vercel api) Should we instead move rust api to /pages/api? Could you provide working example?

I expect this potential issues:

  • package.json / vercel-build may be ignored under /pages so we will need to use package.json from the root of project
  • wasm/.so files will not be deployed by default, this in theory is possible through nextjs config / webpack options.

YuriGor avatar Jul 24 '22 20:07 YuriGor

BTW similar issue I faced when tried to use rust runtime in NextJS app. But that case is even worse, because vercel.json/functions/runtime config will not work under /pages/api so moving api under /pages is not an option also.

YuriGor avatar Jul 24 '22 20:07 YuriGor