Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

multipart parsing monkey-patch not working for installPolyfills() #5349

Closed
vekunz opened this issue Jul 4, 2022 · 3 comments · Fixed by #5629
Closed

multipart parsing monkey-patch not working for installPolyfills() #5349

vekunz opened this issue Jul 4, 2022 · 3 comments · Fixed by #5629

Comments

@vekunz
Copy link

vekunz commented Jul 4, 2022

Describe the bug

In this pull request #5292 you "added" support for multipart parsing into undici. But it seems that this does not work, if I install polyfills with installPolyfills().

Reproduction

const formData = new FormData();
formData.set('email', '[email protected]');

const request = new Request('https://domain.de/my/path', {
  method: 'POST',
  headers: {},
  body: formData
});

await event.request.formData(); // <-- this failes

Logs

NotSupportedError: multipart/form-data not supported
 ❯ Request$2.formData ../../../../../../../../../C:/path/to/poject/node_modules/@sveltejs/kit/dist/node/polyfills.js:1921:13
 ❯ src/routes/signup/_index.spec.ts:97:26
     95|       };
     96| 
     97|       await event.request.formData();
       |                          ^

System Info

System:                                                    
    OS: Windows 10 10.0.19044                                
    CPU: (12) x64 Intel(R) Core(TM) i7-9850H CPU @ 2.60GHz   
    Memory: 13.04 GB / 31.79 GB                              
  Binaries:                                                  
    Node: 16.15.1 - C:\Program Files\nodejs\node.EXE         
    npm: 8.13.2 - C:\Program Files\nodejs\npm.CMD            
  Browsers:                                                  
    Chrome: 103.0.5060.66                                    
    Edge: Spartan (44.19041.1266.0), Chromium (103.0.1264.44)
    Internet Explorer: 11.0.19041.1566                       
  npmPackages:                                               
    @sveltejs/adapter-node: 1.0.0-next.78 => 1.0.0-next.78   
    @sveltejs/kit: 1.0.0-next.357 => 1.0.0-next.357          
    svelte: 3.48.0 => 3.48.0

Severity

blocking all usage of SvelteKit

Additional Information

Currently, this is one problem of at least two problems with undici, that block an update of SvelteKit (the other problem is that mswjs currently has no support for undici).

@Rich-Harris
Copy link
Member

Please submit an actual reproduction

@vekunz
Copy link
Author

vekunz commented Jul 6, 2022

I created a GitHub Repository to reproduce the issue https://github.com/vekunz/sveltekit-undici-formdata-issue.

While creating the repository I noticed that the error has changed in the latest release 1.0.0-beta.359.

SvelteKit 1.0.0-beta.358: NotSupportedError: multipart/form-data not supported
SvelteKit 1.0.0-beta.359: TypeError: Request.formData: undefined

I created two branches in the repository to demonstrate both issues.

@tradaonline
Copy link

I'm using FormData with Polyfill and have this problem too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants