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

[BUG] Error: [unenv] Readable.asyncIterator is not implemented yet! #147

Closed
martcarrefour opened this issue Nov 29, 2024 · 5 comments · Fixed by cloudflare/workers-sdk#7431
Labels
bug Something isn't working needs repro

Comments

@martcarrefour
Copy link

Describe the bug

When calling a server action from a client component in a Next.js application, the following error occurs during runtime(cloudflare logs)

{
  "message": "Error: [unenv] Readable.asyncIterator is not implemented yet!",
  "level": "error",
  "$cloudflare": {
    "event": {
      "request": {
        "url": "https://frontend-staging.12345.biz/create",
        "method": "POST",
        "path": "/create"
      }
    },
    "scriptName": "frontend-dev",
    "eventType": "fetch",
    "executionModel": "stateless",
    "scriptVersion": {
      "id": "231baf04-e629-3456-ab0f-ce69779f5e0f"
    },
    "truncated": false,
    "$metadata": {
      "requestId": "8ea3213eb2f39a"
    }
  }
}

Steps to reproduce

Create a server action file (testFN.ts):

"use server";

export async function testFN() {
  console.log("test");
}

Use it in a client component:

"use client";

import { testFN } from "./testFN";

export default function ButtonComponent() {
  return <button onClick={() => testFN()}>TEST</button>;
}

Expected behavior

The server action should execute successfully, and the console.log message should appear in the server logs.

@opennextjs/cloudflare version

experimental

Node.js version

22.11.0

Wrangler version

3.87.0

next info output

Operating System:
  Platform: win32
  Arch: x64
  Version: Windows 11 Pro
  Available memory (MB): 49084
  Available CPU cores: 16
Binaries:
  Node: 22.11.0
  npm: N/A
  Yarn: N/A
  pnpm: N/A
Relevant Packages:
  next: 14.2.15 // An outdated version detected (latest is 15.0.3), upgrade is highly recommended!
  eslint-config-next: 14.2.15
  react: 18.3.1
  react-dom: 18.3.1
  typescript: 5.5.4
Next.js Config:
  output: N/A
 ⚠ An outdated version detected (latest is 15.0.3), upgrade is highly recommended!
   Please try the latest canary version (`npm install next@canary`) to confirm the issue still exists before creating a new issue.
   Read more - https://nextjs.org/docs/messages/opening-an-issue

Additional context

No response

@martcarrefour martcarrefour added bug Something isn't working triage labels Nov 29, 2024
@vicb vicb added needs repro and removed triage labels Nov 29, 2024
@vicb
Copy link
Contributor

vicb commented Nov 29, 2024

@martcarrefour could you please link to a repro on github, it would help speed up the investigation.
Thanks!

@vicb
Copy link
Contributor

vicb commented Dec 2, 2024

I created a repro at https://github.com/vicb/test-next-server-action

I have validated a fix (in the fix) branch - I am discussing with @pi0 on how to best integrate this in unenv

@vicb
Copy link
Contributor

vicb commented Dec 3, 2024

@martcarrefour thanks for reporting that issue. It help fix a couple things

  • an issue in unenv, fixed with the help of @pi0
  • an issue in Open Next, fixed with the help of @conico974

This issue should auto-close when the unenv is merged into wrangler - it might take a few more days for wrangler to be released (you can test with the wrangler pre-release on the PR and updating the experimental branch)

@martcarrefour
Copy link
Author

@vicb Thank you so much for the quick resolution of the issue!

Apologies for not providing the repository right away – I rarely create GitHub issues and am not very experienced with the process.

@vicb
Copy link
Contributor

vicb commented Dec 4, 2024

no problem, what matters in the end is that the issue is getting fixed.

vicb added a commit that referenced this issue Dec 6, 2024
wrangler 3.93.0 has an updated unenv using the native workerd stream implementation.
It fixes an issue with server actions.

Ref:
- #147
- unjs/unenv#363
vicb added a commit that referenced this issue Dec 6, 2024
wrangler 3.93.0 has an updated unenv using the native workerd stream implementation.
It fixes an issue with server actions.

Ref:
- #147
- unjs/unenv#363
vicb added a commit that referenced this issue Dec 10, 2024
wrangler 3.93.0 has an updated unenv using the native workerd stream implementation.
It fixes an issue with server actions.

Ref:
- #147
- unjs/unenv#363
vicb added a commit that referenced this issue Dec 20, 2024
wrangler 3.93.0 has an updated unenv using the native workerd stream implementation.
It fixes an issue with server actions.

Ref:
- #147
- unjs/unenv#363
vicb added a commit that referenced this issue Dec 20, 2024
wrangler 3.93.0 has an updated unenv using the native workerd stream implementation.
It fixes an issue with server actions.

Ref:
- #147
- unjs/unenv#363
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working needs repro
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants