question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Bug]: failed parse FormData with Cloudflare

See original GitHub issue

What version

0.0.2

What happend

input-resolvers.ts#L6-L7 failed parse FormData with Cloudflare Pages functions.

Steps to Reproduce

I found that new URLSearchParams().toString() return "" with Cloudflare Pages functions at ergofriend/remix-cloudflare-pages

debug code

const formData = await request.clone().formData()
const data = new URLSearchParams(formData as URLSearchParams).toString()
const json = JSON.stringify(Object.fromEntries(formData.entries()))
sentry.captureMessage(`action URLSearchParams: ${JSON.stringify(data)} json: ${json}`)

sentry.io console

// local (wrangler2)
action URLSearchParams: "like=takenoko" json: {"like":"takenoko"}

// cloudflare pages functions
action URLSearchParams: "" json: {"like":"takenoko"}

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
ergofriendcommented, Apr 22, 2022

thx, but I got same error Invalid enum value. Expected 'takenoko' | 'kinoko'. And console debug said same result as below.

const newData = new URLSearchParams(formData.entries() as unknown as URLSearchParams).toString()
// local
action data: like=takenoko newData: like=takenoko json: {"like":"takenoko"}
// cloudflare
action data:  newData:  json: {"like":"takenoko"}

Exactly, I will report to remix, thank you for your cooperation.

1reaction
diogobcommented, Apr 22, 2022

@ergofriend could you try reproducing the issue using the package from the branch cloudflare-adapter-workaround ? You can install locally by using the following entry in your package.json:

    "remix-domains": "github:SeasonedSoftware/remix-domains#cloudflare-adapter-workaround",

If the error persists you should report the issue in the remix repo since the cloudflare adapter would have to be fixed.

Read more comments on GitHub >

github_iconTop Results From Across the Web

ERROR 5400: Bad request: Error parsing form fields with Node
Hi, I have the following POST handler in my node (Remix) server: export async function action({ request }: ActionArgs) ...
Read more >
File type error when uploading file via formData #48 - GitHub
When trying upload file with formData miniflare is throwing following error: /home/pagan/webdev/kvms/backend/node_modules/formdata-node/lib/FormData.js:286 ...
Read more >
Network Connection Lost - saving form data (file) to R2 bucket ...
I just noticed that you're calling formData on the request. This is causing you to read the object into RAM. Workers has a...
Read more >
FormData - Web APIs | MDN
Chrome Edge FormData Full support. Chrome5. Toggle history Full support. Edge12. Toggl... @@iterator Full support. Chrome50. Toggle history Full support. Edge18. Toggl... FormData() constructor Full support....
Read more >
cloudscraper - npm
3 this error is returned when library failed to parse and solve js challenge. error will be String with some details. ⚠️ ⚠️...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found