remix icon indicating copy to clipboard operation
remix copied to clipboard

`TypeError: unusable` when reading form data in actionfunction using miniflare / Cloudflare

Open stepri opened this issue 3 years ago • 2 comments

What version of Remix are you using?

1.2.3

Steps to Reproduce

  • create a new project using Cloudflare Pages
  • create a form with a POST method
  • create an action and try to read formdata
  • run project using npm run dev

This error also happens on Cloudflare Workers

See example repo: https://github.com/stepri/formdata-remix-cloudflare/blob/main/app/routes/test.tsx

Expected Behavior

No error

Actual Behavior

500 Internal Server Error:

TypeError: unusable
    at Request.clone (/myproject/node_modules/undici/lib/fetch/request.js:725:13)
    at Request.clone (/myproject/node_modules/@miniflare/core/src/standards/http.ts:423:38)
    at renderDocumentRequest (/myproject/node_modules/@remix-run/server-runtime/esm/server.js:414:50)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at requestHandler (/myproject/node_modules/@remix-run/server-runtime/esm/server.js:51:20)
    at handleFetch (/myproject/node_modules/@remix-run/cloudflare-pages/esm/worker.js:47:18)
    at /myproject/node_modules/@remix-run/cloudflare-pages/esm/worker.js:55:14
    at next (/myproject/node_modules/wrangler/pages/functions/template-worker.ts:108:26)
    at EventTarget.[kDispatchFetch] (/myproject/node_modules/@miniflare/core/src/standards/event.ts:359:13)
    at Server.<anonymous> (/myproject/node_modules/@miniflare/http-server/src/index.ts:168:20)

stepri avatar Mar 03 '22 16:03 stepri

I'm experiencing the same issue. However this happens only if I disable Javascript on the site.

AntanasMisiunas avatar Mar 06 '22 20:03 AntanasMisiunas

Using Form component provided by Remix instead of form is a good workaround, it has solved my issue.

alphabetek avatar Mar 10 '22 17:03 alphabetek