#▲ error - Provided runtime "edge" is not supported.

1 messages · Page 1 of 1 (latest)

eternal pecan
#

Hi, I am creating a project with NextJs,in which there are some page functions under /pages/api/xxx.ts.

I have read the docs from NextJs' site to adapt my code to cf pages env by adding the code below

export const config = { runtime: 'edge' };

or

export const runtime = 'edge';

But I got the following error.



17:35:16.870    ▲  info  - Creating an optimized production build...
17:35:16.926    ▲  error - Provided runtime "edge" is not supported. Please leave it empty or choose one of: experimental-edge, nodejs
17:35:16.940    ▲  ELIFECYCLE  Command failed with exit code 1.
17:35:17.008    ▲  Error: Command "pnpm run build" exited with 1
17:35:17.117    ▲  ERROR  Command failed with exit code 1: vercel build
17:35:17.117    ▲  
17:35:17.117    ▲  pnpm: Command failed with exit code 1: vercel build
17:35:17.118    ▲     at makeError (/opt/buildhome/.cache/node/corepack/pnpm/8.2.0/dist/pnpm.cjs:24230:17)
17:35:17.118    ▲     at handlePromise (/opt/buildhome/.cache/node/corepack/pnpm/8.2.0/dist/pnpm.cjs:24801:33)
17:35:17.118    ▲     at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
17:35:17.118    ▲     at async Object.handler [as dlx] (/opt/buildhome/.cache/node/corepack/pnpm/8.2.0/dist/pnpm.cjs:206486:7)
17:35:17.118    ▲     at async /opt/buildhome/.cache/node/corepack/pnpm/8.2.0/dist/pnpm.cjs:215818:21

I don't know why, thanks for your help.

cerulean kindle
#

Try experimental-edge

eternal pecan
#

19:09:02.300 ⚡️
19:09:02.301 ⚡️ Please make sure that all your non-static routes export a config object specifying the edge runtime, like:
19:09:02.301 ⚡️ export const config = { runtime: 'edge' };
19:09:02.301 ⚡️
19:09:02.301 ⚡️ You can read more about the Edge Runtime on the Next.js documentation:
19:09:02.301 ⚡️ https://nextjs.org/docs/app/building-your-application/rendering/edge-and-nodejs-runtimes
19:09:02.301
19:09:02.339 Failed: Error while executing user command. Exited with error code: 1
19:09:02.349 Failed: build command exited with code: 1
19:09:03.205 Failed: error occurred while running build command

Learn about the switchable runtimes (Edge and Node.js) in Next.js.

cerulean kindle
#

Please send the full log.

eternal pecan
#

19:08:48.705 ▲ ./node_modules/.pnpm/@[email protected]/node_modules/@paypal/paypalhttp/lib/paypalhttp/serializer/multipart.js
19:08:48.705 ▲ A Node.js API is used (Buffer at line: 51) which is not supported in the Edge Runtime.

#

I think that is the culprit. I involve some libs that aren't supported by edge environment

cerulean kindle
#

Yeah, it looks like Next.js doesn't consider that library to be compatible with the edge runtime when it builds your app

eternal pecan