Closed nathanburgess closed 2 months ago
Strange, which version of Next are you using?
Strange, which version of Next are you using?
14.0.4
Are you able to to push a reproduction repo somewhere?
https://github.com/nathanburgess/workos-bug-repo
This is using Next 14.0.4 in Turborepo
This is affecting me as well.
@nathanburgess I haven't found a way to run your repository unfortunately.
I wonder, is it specific to Turborepo? or this version of next? etc.
It would help to isolate what the issue is about.
@palmithor Are you able to provide some info on your setup too to see if it matches some of these above?
Thanks! 🙏
@benoitgrelard
git clone https://github.com/nathanburgess/workos-bug-repo
pnpm i
apps/web/.env
pnpm dev
That'll get the repro running and you'll see the output below printed to the terminal:
web:dev:
web:dev: ▲ Next.js 14.0.4
web:dev: - Local: http://localhost:3000
web:dev: - Environments: .env
web:dev:
web:dev: ✓ Ready in 1553ms
web:dev: ✓ Compiled /not-found in 308ms (398 modules)
web:dev: ⚠ Fast Refresh had to perform a full reload due to a runtime error.
web:dev: ✓ Compiled /src/middleware in 128ms (331 modules)
web:dev: ○ Compiling / ...
web:dev: ⨯ ../../node_modules/@workos-inc/nextjs/dist/cjs/impersonation.js
web:dev: Module parse failed: 'import' and 'export' may appear only with 'sourceType: module' (1:106)
web:dev: > /* __next_internal_action_entry_do_not_use__ {"51389d01f9c684912006828677ea5047beae752a":"$$ACTION_1"} */ import { createActionProxy } from "private-next-rsc-action-proxy";
web:dev: | import { encryptActionBoundArgs, decryptActionBoundArgs } from "private-next-rsc-action-encryption";
web:dev: | "use strict";
web:dev:
web:dev: Import trace for requested module:
web:dev: ../../node_modules/@workos-inc/nextjs/dist/cjs/impersonation.js
web:dev: ../../node_modules/@workos-inc/nextjs/dist/cjs/index.js
web:dev: ./src/app/page.tsx
web:dev: ⨯ ../../node_modules/@workos-inc/nextjs/dist/cjs/impersonation.js
web:dev: Module parse failed: 'import' and 'export' may appear only with 'sourceType: module' (1:106)
web:dev: > /* __next_internal_action_entry_do_not_use__ {"51389d01f9c684912006828677ea5047beae752a":"$$ACTION_1"} */ import { createActionProxy } from "private-next-rsc-action-proxy";
web:dev: | import { encryptActionBoundArgs, decryptActionBoundArgs } from "private-next-rsc-action-encryption";
web:dev: | "use strict";
web:dev:
web:dev: Import trace for requested module:
web:dev: ../../node_modules/@workos-inc/nextjs/dist/cjs/impersonation.js
web:dev: ../../node_modules/@workos-inc/nextjs/dist/cjs/index.js
web:dev: ./src/app/page.tsx
web:dev: ⚠ Fast Refresh had to perform a full reload due to a runtime error.
@nathanburgess thanks, I knew what to do, I just had trouble installing pnpm without busting my local env. I found a way eventually and was able to replicate the issue with the repo.
I tried figuring out what’s going on but I don’t think it’s something our side. If you look at the messages it points to something in Next.js, specifically starting from our Impersonation
component which is a React server component using a server action, and you can see the issue is related to that. (Note the next import private-next-rsc-action-encryption
). So it looks to me like some kind of misconfiguration in modules in this version of Next.js.
I was able to reliably get everything to work by updating Next.js in that repository to ^14.1.0
.
So I would say the best course of action is to upgrade Next.js to a more recent version (also there isn’t any stable version between 14.0.4
and 14.1.0
).
Cool cool, I'll give that a try again. I swear I tried upgrading Next last time. ¯\_(ツ)_/¯
I'm seeing this error when attempting to use
getUser