Your worker created multiple branches of a single stream
Unanswered
Tramp ant posted this in #help-forum
Tramp antOP
Hi,
I am asking for assistance here since maybe someone else encountered this issue. I am using NextJS on Cloudflare, and after adding Clerk I receive:
1. Installed cloudflare-next-on-pages: https://developers.cloudflare.com/pages/framework-guides/nextjs/deploy-a-nextjs-site/#create-a-new-project-using-the-create-cloudflare-cli-c3
2. Installed Clerk: https://clerk.com/docs/quickstarts/nextjs
3. Added user print to app\page.tsx
Build:
And when I visit the index page, I can see the user id printed, but the logs complain:
It also has quite some delay because of this.
I have a private repo with this setup if anyone is interested in checking it out.
Please advise and thank you!
I am asking for assistance here since maybe someone else encountered this issue. I am using NextJS on Cloudflare, and after adding Clerk I receive:
Your worker created multiple branches of a single stream. I haven't actually customised anything, I just followed these steps:1. Installed cloudflare-next-on-pages: https://developers.cloudflare.com/pages/framework-guides/nextjs/deploy-a-nextjs-site/#create-a-new-project-using-the-create-cloudflare-cli-c3
2. Installed Clerk: https://clerk.com/docs/quickstarts/nextjs
3. Added user print to app\page.tsx
Build:
npx @cloudflare/next-on-pages && npx wrangler pages dev .vercel/output/static --compatibility-flag=nodejs_compat --compatibility-date=2024-02-17And when I visit the index page, I can see the user id printed, but the logs complain:
✨ Compiled Worker successfully
â›…ï¸ wrangler 3.28.1
-------------------
Using vars defined in .dev.vars
Your worker has access to the following bindings:
- Vars:
- NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY: "(hidden)"
- CLERK_SECRET_KEY: "(hidden)"
⎔ Starting local server...
Parsed 1 valid header rule.
[wrangler:inf] Ready on http://localhost:8788
✘ [ERROR] INFO: Clerk: The request to / is being redirected because there is no signed-in user, and the path is not included in `ignoredRoutes` or `publicRoutes`. To prevent this behavior, choose one of:
1. To make the route accessible to both signed in and signed out users, pass `publicRoutes: ["/"]`
to authMiddleware
2. To prevent Clerk authentication from running at all, pass `ignoredRoutes:
["/((?!api|trpc))(_next.*|.+\.[\w]+$)", "/"]` to authMiddleware
3. Pass a custom `afterAuth` to authMiddleware, and replace Clerk's default behavior of
redirecting unless a route is included in publicRoutes
For additional information about middleware, please visit https://clerk.com/docs/nextjs/middleware
(This log only appears in development mode, or if `debug: true` is passed to authMiddleware)
[wrangler:inf] GET / 307 Temporary Redirect (293ms)
[wrangler:inf] GET / 401 Unauthorized (3ms)
[wrangler:inf] GET /favicon.ico 304 Not Modified (8ms)
[wrangler:inf] GET / 200 OK (5276ms)
✘ [ERROR] Your worker created multiple branches of a single stream (for instance, by calling `response.clone()` or `request.clone()`) but did not read the body of both branches. This is wasteful, as it forces the system to buffer the entire stream of data in memory, rather than streaming it through. This may cause your worker to be unexpectedly terminated for going over the memory limit. If you only meant to copy the request or response headers and metadata (e.g. in order to be able to modify them), use the appropriate constructors instead (for instance, `new Response(response.body, response)`, `new Request(request)`, etc).
[wrangler:inf] GET /vercel.svg 304 Not Modified (6ms)
[wrangler:inf] GET /next.svg 304 Not Modified (7ms)
[wrangler:inf] GET /_next/static/chunks/983-c740277b6d3702da.js 200 OK (8ms)
[wrangler:inf] GET /_next/static/chunks/app/page-cf19a580b1879b0e.js 200 OK (6ms)It also has quite some delay because of this.
I have a private repo with this setup if anyone is interested in checking it out.
Please advise and thank you!
1 Reply
Tramp antOP
Anyone?