Closed AlecKriebel closed 1 year ago
Digging into the build output from version 0.10.2, this is likely a dupe of #39 (wasm being imported). Please close if that can be verified.
I've confirmed I can get builds to succeed if I prevent my /api/og
(which uses @vercel/og
which uses wasm), and my editor/pages.tsx
(which uses @editorjs/editorjs
, which seems to use wasm?) from being bundled into the .vercel/output
Here's the /api/og
: https://github.com/shadcn/taxonomy/blob/main/app/api/og/route.tsx
Here's the /editor/[postid]
server-rendered page: https://github.com/shadcn/taxonomy/blob/main/app/(editor)/editor/%5BpostId%5D/page.tsx
If this is the wasm issue, being able to check a package for compatibility with workers would be hugely beneficial and save tons of time!
Hey there, sorry to hear you're running into problems 🙁.
If possible, please don't use 0.10.2, that is a very old version that we no longer offer support for, nor is it at all similar to the current state of the library, or representative of many fixes we've implemented since then. It would be appreciated if all debugging is done against the latest release 🙂.
Anyway, onto the actual SyntaxError. The stack trace looks like it is referencing functions in acorn
, presumably from when we call parse
. As you checked the box that you were interested in helping, my suggestion might be to log the function file paths being parsed and try to find the one causing the error, and then try and find the line/position in the code that it references when throwing the error.
You could also try out the prerelease in https://github.com/cloudflare/next-on-pages/pull/325 and see if it's related to that.
Just to chime back in here for anyone else that finds this, the prerelease branch linked does not fix the issue unfortunately :(
I'll find some time to debug & dig further into this soon, however!
@AlecKriebel it's just a hunch but could you try the latest beta release? @james-elicx has cleaned up some code related to your issue, I think there is a chance that it might be solving your issue
Closing this issue due to inactivity (and because the bug might have been fixed since the issue was created)
@AlecKriebel is you circle back to this and still experience the bug please feel free to ping me and/or reopen the issue 🙏
same issue on wsl 2
I fixed it by editing it manually. (latest version)
/home/edamamex/.bun/install/global/node_modules/@cloudflare/next-on-pages/dist/index.js:4872
this.script = s4, this.pmCmd = void 0, this.targetArgs = (r2 == null ? void 0 : r2.args) ?? [];
^
SyntaxError: Unexpected token '?'
at wrapSafe (internal/modules/cjs/loader.js:915:16)
at Module._compile (internal/modules/cjs/loader.js:963:27)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)
at Module.load (internal/modules/cjs/loader.js:863:32)
at Function.Module._load (internal/modules/cjs/loader.js:708:14)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:60:12)
at internal/main/run_main_module.js:17:47
next-on-pages environment related information
System: Platform: darwin Arch: arm64 Version: Darwin Kernel Version 22.1.0: Sun Oct 9 20:15:09 PDT 2022; root:xnu-8792.41.9~2/RELEASE_ARM64_T6000 CPU: (10) arm64 Apple M1 Pro Memory: 16 GB Shell: /bin/zsh Binaries: Node: 19.4.0 Yarn: 1.22.19 npm: 9.6.6 pnpm: N/A Package Manager Used: npm Relevant Packages: @cloudflare/next-on-pages: 1.1.0 vercel: [object Promise] next: [object Promise]
Description
next-on-pages builds are failing with the error
SyntaxError: Unexpected token (268:4)
This is reproducible locally and on Cloudflare pages for me. A different project I have locally, using the same versions of packages, is succeeding.
Both projects are using the app router with server components, and pages/api, however the failing repo is making use of
not-found
,og
, &robots
Next.js features.Reproduction
My repo is private, but the package in questions is a direct adaption of https://github.com/shadcn/taxonomy that's modified to be deployed on Cloudflare pages using
next-on-pages
(addingexport const runtime = "edge";
atop many files).I do not have reproduction steps since I don't know the root cause, but would be happy to provide my
.vercel/output
if it'd be useful!Pages Deployment Method
Pages CI (GitHub/GitLab integration)
Pages Deployment ID
f39a87aa-4213-4967-b436-d903cc723636
Additional Information
On
next-on-pages
version 0.10.2, I get the error output:Would you like to help?