Description
This was originally reported on Discord server by Petr.
Expected Behavior
When using OneSDK in Next.js with API routes, I expect for them to work without any problem wherever I deploy the application, especially to Vercel.
Current Behavior
SDK throws an exception during initialization:
File referenced in super.json not found: /var/task/superface/grid/weather/[email protected]
Possible Solution
Next.js on Vercel doesn't allow importing of files per documentation.
Possible workarounds include moving the API route from /pages/api
to /api
so it is executed in Node.js runtime (and hence not a subject to the bundling), but there may be other solutions as well.
Steps to Reproduce
Here is repro project: https://github.com/jnv/one-sdk-nextjs-vercel-repro
It's a vanilla Next.js project with OneSDK and the additional /api/weather
route (see here).
The route can be executed here: https://one-sdk-nextjs-vercel-repro.vercel.app/api/weather
An error is thrown instead of successful perform.
Your Environment
- Next.js v12.0.10
- OneSDK v1.3.0
- Vercel