Skip to content

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

@vekunz

Description

@vekunz

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).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions