-
Notifications
You must be signed in to change notification settings - Fork 168
[🐛 Bug]: SyntaxError while building an app with @clerk/nextjs
npm package #270
Description
next-on-pages environment related information
System:
Platform: linux
Arch: x64
Version: #1 SMP Fri Jan 27 02:56:13 UTC 2023
CPU: (12) x64 12th Gen Intel(R) Core(TM) i7-1255U
Memory: 8 GB
Shell: /bin/bash
Binaries:
Node: 18.15.0
Yarn: 1.22.19
npm: 9.5.0
pnpm: 8.3.1
Package Manager Used: npm
Relevant Packages:
@cloudflare/next-on-pages: 0.0.0-97c8739 (beta/canary release)
vercel: N/A
next: 13.4.3
Description
Building a Next.js app with the @clerk/nextjs
npm package causes a SyntaxError during the build process:
⚡️ @cloudflare/next-on-pages CLI v.0.0.0-97c8739 (beta/canary release)
⚡️ Detected Package Manager: npm
⚡️ Preparing project...
⚡️ Project is ready
⚡️ Building project...
▲ Next-On-Pages-Vercel-CLI CLI 29.3.0-next-on-pages-fix-3
▲ WARNING: You should not upload the `.next` directory.
▲ Installing dependencies...
▲ up to date in 476ms
▲ 138 packages are looking for funding
▲ run `npm fund` for details
▲ Detected Next.js version: 13.4.3
▲ Detected `package-lock.json` generated by npm 7+...
▲ Running "npm run build"
▲ > [email protected] build
▲ > next build
▲ - info Creating an optimized production build...
▲ - info Compiled successfully
▲ - info Linting and checking validity of types...
▲ - info Collecting page data...
▲ - info Generating static pages (0/3)
▲ - info Generating static pages (3/3)
▲ - info Finalizing page optimization...
▲
▲ Route (app) Size First Load JS
▲ ┌ ℇ / 4.77 kB 81.8 kB
▲ └ ○ /favicon.ico 0 B 0 B
▲ + First Load JS shared by all 77.1 kB
▲ ├ chunks/139-601a8d7b508ad4e1.js 24.7 kB
▲ ├ chunks/2443530c-d4a6bd7fc7f21e3c.js 50.5 kB
▲ ├ chunks/main-app-4bcdaf5f1af99d9b.js 215 B
▲ └ chunks/webpack-13cb6a530b2d87f9.js 1.64 kB
▲
▲ Route (pages) Size First Load JS
▲ ─ ○ /404 178 B 83.9 kB
▲ + First Load JS shared by all 83.7 kB
▲ ├ chunks/main-b6a5a6d43628902d.js 81.9 kB
▲ ├ chunks/pages/_app-c544d6df833bfd4a.js 192 B
▲ └ chunks/webpack-13cb6a530b2d87f9.js 1.64 kB
▲
▲ ƒ Middleware 346 kB
▲ ℇ (Streaming) server-side renders with streaming (uses React 18 SSR streaming or Server Components)
▲ ○ (Static) automatically rendered as static HTML (uses no initial props)
▲ Traced Next.js server files in: 4.164s
▲ Created all serverless functions in: 1.558s
▲ Collected static files (public/, static/, .next/static): 8.917ms
▲ Using TypeScript 5.0.4 (local user-provided)
▲ Build Completed in .vercel/output [33s]
⚡️ Completed `npx vercel build`.
/home/bbari/.npm/_npx/be5105308c27b00d/node_modules/@cloudflare/next-on-pages/dist/index.js:10511
var err = new SyntaxError(message);
^
SyntaxError: Unexpected token (3:10)
at pp$4.raise (/home/bbari/.npm/_npx/be5105308c27b00d/node_modules/@cloudflare/next-on-pages/dist/index.js:10511:13)
at pp$9.unexpected (/home/bbari/.npm/_npx/be5105308c27b00d/node_modules/@cloudflare/next-on-pages/dist/index.js:8105:8)
at pp$9.semicolon (/home/bbari/.npm/_npx/be5105308c27b00d/node_modules/@cloudflare/next-on-pages/dist/index.js:8087:10)
at pp$8.parseExpressionStatement (/home/bbari/.npm/_npx/be5105308c27b00d/node_modules/@cloudflare/next-on-pages/dist/index.js:8568:8)
at pp$8.parseStatement (/home/bbari/.npm/_npx/be5105308c27b00d/node_modules/@cloudflare/next-on-pages/dist/index.js:8297:21)
at pp$8.parseTopLevel (/home/bbari/.npm/_npx/be5105308c27b00d/node_modules/@cloudflare/next-on-pages/dist/index.js:8159:21)
at Parser2.parse (/home/bbari/.npm/_npx/be5105308c27b00d/node_modules/@cloudflare/next-on-pages/dist/index.js:7958:15)
at Function.parse2 [as parse] (/home/bbari/.npm/_npx/be5105308c27b00d/node_modules/@cloudflare/next-on-pages/dist/index.js:8013:35)
at parse3 (/home/bbari/.npm/_npx/be5105308c27b00d/node_modules/@cloudflare/next-on-pages/dist/index.js:12320:17)
at extractWebpackChunks (/home/bbari/.npm/_npx/be5105308c27b00d/node_modules/@cloudflare/next-on-pages/dist/index.js:12638:26) {
pos: 133,
loc: Position2 { line: 3, column: 10 },
raisedAt: 178
}
Node.js v18.15.0
This app runs properly locally with next dev
and builds properly with next build
, which suggests it's not an issue with @clerk/nextjs
itself (I apologize in advance if this is not an issue on the next-on-pages
end).
This example fails on the stable version of next-on-pages
with a wasm
import error, which is why I'm running against the beta version. Wanted to mention that in case this has something to do with wasm
support.
Reproduction
Here is a repo that demonstrates the issue: https://github.com/bharatari/build-error-repro. I generated the app via create-next-app
, added export const runtime = "edge";
to app/page.tsx
and then simply added a middleware.ts
file that imports the @clerk/nextjs
package.
Pages Deployment Method
None
Pages Deployment ID
No response
Additional Information
No response
Would you like to help?
- Would you like to help fixing this bug?