Closed danawoodman closed 2 years ago
i did this!
@danawoodman you need to stub in FormData or run it in an environment like MiniFlare or CF Workerd where FormData is stubbed in for you.
@Crisfole Why would it not need to be stubbed locally tho? I'm running the same build/test commands
This also brings up a question: if FormData isn't available, itty-fetcher will fail; what can we do about that?
Request
is also not globally available. Nor is Response
. This is Not Your Problem:tm:.
I assume fetch would fail if those aren't available anyways, without some kind of poly fill/override.
Now how do we fix these tests since they work fine locally?
@danawoodman what's your local env like? (Node version?)
Yeah, same issue... pulled this in an hit with FormData immediately.
Sources confirming general browser/worker availability
Questions
If this works fine in most of those runtimes without polyfills, I'd say we add the supporting types to the tsconfig.json
and bypass this issue ourselves. Leave a requirement to polyfill if the user's runtime doesn't support it. Conversely we try/catch, but...
This will work in SK, Workers, Pages, it will work in > Node 18:
That screenshot is from just after nvm install v18
I must be using 18. Will confirm when I'm home
@kwhitley I've updated the actions to use Node 18 (fixes actions), added a .node-version
file to set that locally and added some notes in the readme. I think this is ready for your review!
Thanks @Crisfole for pointing me to the solution!
This is awesome, only comment is that thing about 18.0.0 vs 18.10.0, but i'll merge and tweak that :)
@kwhitley thanks! I didn't see a note on 18, what was your question? 18.10.0 is the latest version so I opted for that for local dev. The actual action runs on anything 18+ which I think is ok
FormData
as-is instead ofJSON.stringify
ing it as we do now. Should only add a few bytes to the final bundleFormData
Closes #10