Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Errors with recent node filesystem versions in nextjs #2522

Closed
stratospark opened this issue Apr 15, 2024 · 1 comment
Closed

Errors with recent node filesystem versions in nextjs #2522

stratospark opened this issue Apr 15, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@stratospark
Copy link

What version of Effect is running?

2.4.18

What steps can reproduce the bug?

Created a minimal repro here: https://github.com/stratospark/next-effect-fs-bug

Run the server: npm run dev or bun --bun run dev.

Open http://localhost:3000. Click the only button and watch the server console for errors.

What is the expected behavior?

Should output a list of files from /tmp

What do you see instead?

In main branch, with "@effect/platform-node": "^0.45.28",

 ⨯ ./node_modules/undici/lib/web/fetch/util.js
Module parse failed: Unexpected token (884:57)
|       // 5. If object is not a default iterator object for interface,
|       //    then throw a TypeError.
>       if (typeof this !== 'object' || this === null || !(#target in this)) {
|         throw new TypeError(
|           `'next' called on an object that does not implement interface ${name} Iterator.`

Import trace for requested module:
./node_modules/undici/lib/web/fetch/util.js
./node_modules/undici/lib/web/fetch/index.js
./node_modules/undici/index.js
./node_modules/@effect/platform-node/dist/esm/internal/http/clientUndici.js
./node_modules/@effect/platform-node/dist/esm/NodeHttpClient.js
./node_modules/@effect/platform-node/dist/esm/index.js
./src/app/action.ts

In errors-but-still-works branch, with "@effect/platform-node": "0.45.14":

./node_modules/@parcel/watcher/index.js
Module not found: Can't resolve './build/Debug/watcher.node' in '/Users/patr/Code/next-effect-fs-bug/node_modules/@parcel/watcher'

Import trace for requested module:
./node_modules/@parcel/watcher/index.js
./node_modules/@effect/platform-node-shared/dist/esm/internal/fileSystem.js
./node_modules/@effect/platform-node-shared/dist/esm/NodeFileSystem.js
./node_modules/@effect/platform-node/dist/esm/NodeContext.js
./node_modules/@effect/platform-node/dist/esm/index.js
./src/app/action.ts
01E30475-1030-469D-A40C-8FC917A0EDB1_IN
01E30475-1030-469D-A40C-8FC917A0EDB1_OUT
04756D81-F81F-46E2-898C-2D5120B587B4_IN
04756D81-F81F-46E2-898C-2D5120B587B4_OUT
07F949C4-B4F4-499D-8C39-D23BAA55914C_IN
07F949C4-B4F4-499D-8C39-D23BAA55914C_OUT
0B04105C-E951-4D1C-A857-50A818BF7996_IN
0B04105C-E951-4D1C-A857-50A818BF7996_OUT
0B0B6B7D-1A8B-498B-99EF-FA9D87E45C82_IN
...

In older-no-errorsbranch, with "@effect/platform-node": "0.45.1":

 ○ Compiling / ...
 ✓ Compiled / in 3.1s (1012 modules)
01E30475-1030-469D-A40C-8FC917A0EDB1_IN
01E30475-1030-469D-A40C-8FC917A0EDB1_OUT
04756D81-F81F-46E2-898C-2D5120B587B4_IN
04756D81-F81F-46E2-898C-2D5120B587B4_OUT
07F949C4-B4F4-499D-8C39-D23BAA55914C_IN
07F949C4-B4F4-499D-8C39-D23BAA55914C_OUT
0B04105C-E951-4D1C-A857-50A818BF7996_IN
...

Additional information

(base) ➜  next-effect-fs-bug git:(older-no-errors) bun --version
1.0.25
(base) ➜  next-effect-fs-bug git:(older-no-errors) npm --version
10.2.4
(base) ➜  next-effect-fs-bug git:(older-no-errors) node --version
v21.6.2

Version of next: "next": "14.1.4"

@stratospark stratospark added the bug Something isn't working label Apr 15, 2024
@fubhy
Copy link
Member

fubhy commented Apr 16, 2024

This is a known bug with Next.js and SWC. The syntax error it is failed on is, in fact, valid. Maybe this is helpful for your case: nodejs/undici#2954 (comment)

I'd also suggest to report this in the Next.js issue queue.

@fubhy fubhy closed this as completed Apr 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants