vercel / vercel/workflow

TypeError: Cannot perform ArrayBuffer.prototype.slice - Turborepo - Microfrontends

Open
#448 9 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
2.4k
Forks
365
Avg merge
2d 11h
Merged PRs (30d)
169

Description

I'm trying to get workflows to work on my turborepo but it doesn't work I tried adding a simple owrkflow but I always get this error. I use microfrondends and turborepo

This is my matcher in my proxy.ts:

export const config = {
  matcher: [
    '/((?!_next/static|_next/image|images|locales|assets|api/*|.well-known/workflow/).*)',
    {
      source: '/((?!.well-known/workflow/).*)',
    },
  ],
};

and this is what I'm doing export default withWorkflow(withMicrofrontends(withAnalyzer(config))); in my next.config.ts

I'm using version "workflow": "4.0.1-beta.22",

zeik0:dev: [14:28:43.794] INFO: Triggering test workflow
zeik0:dev:     env: "development"
zeik0:dev:     operation: "triggerTestWorkflow"
zeik0:dev:     userId: "31a03e74-1639-45b6-bfa7-77447f1a4762"
zeik0:dev:     accountId: "5deaa894-2094-4da3-b4fd-1fada0809d1c"
zeik0:dev: [14:28:43.961] INFO: Test workflow started successfully
zeik0:dev:     env: "development"
zeik0:dev:     operation: "triggerTestWorkflow"
zeik0:dev:     workflowRunId: "wrun_01KB3969MR7GPG5HGN30JQ769M"
zeik0:dev:     accountId: "5deaa894-2094-4da3-b4fd-1fada0809d1c"
zeik0:dev:  POST /home/zeik0/smart-discounts 200 in 881ms (compile: 140ms, proxy.ts: 189ms, render: 552ms)
zeik0:dev:  │ GET http://127.0.0.1:54321/auth/v1/user 200 in 154ms (cache skip)
zeik0:dev:  │ │ Cache skipped reason: (fetchCache = default-no-store)
zeik0:dev: [embedded world] Queue operation failed: TypeError: fetch failed
zeik0:dev:     at ignore-listed frames {
zeik0:dev:   [cause]: TypeError: Cannot perform ArrayBuffer.prototype.slice on a detached ArrayBuffer
zeik0:dev:       at ArrayBuffer.slice (<anonymous>)
zeik0:dev: }
zeik0:dev: Discovering workflow directives 34887ms
zeik0:dev: Discovering workflow directives 34881ms
zeik0:dev: Created steps bundle 329ms
zeik0:dev: Created steps bundle 337ms
zeik0:dev: Created intermediate workflow bundle 310ms
zeik0:dev: Created intermediate workflow bundle 462ms
zeik0:dev: Discovering workflow directives 28388ms
zeik0:dev: Discovering workflow directives 28910ms
zeik0:dev: Created steps bundle 252ms
zeik0:dev: Created steps bundle 260ms
zeik0:dev: Failed to write debug file: SyntaxError: Unexpected end of JSON input
zeik0:dev:     at JSON.parse (<anonymous>)
zeik0:dev: Created intermediate workflow bundle 204ms
zeik0:dev: Created intermediate workflow bundle 202ms
zeik0:dev: Failed to write debug file: SyntaxError: Unexpected end of JSON input
zeik0:dev:     at JSON.parse (<anonymous>)

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the failure with workflow 4.0.1-beta.22 using the shown proxy.ts matcher and next.config.ts composition in the Turborepo microfrontend setup. Start from the failed queue operation and detached ArrayBuffer error, then compare the workflow directive discovery and debug-file failures in the logs; done means the workflow triggers without these errors and the resulting configuration or reproduction is documented.

Written by the indexing model from the issue text.

Assessment

Tech stack
next.js, typescript
Domain
backend, web-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.