Btw you should add the svelte package to the envinfo command on the bug reports
System:
OS: macOS 15.0.1
CPU: (8) arm64 Apple M1
Memory: 92.80 MB / 8.00 GB
Shell: 5.9 - /bin/zsh
Binaries:
Node: 21.5.0 - ~/.nvm/versions/node/v21.5.0/bin/node
npm: 10.2.4 - ~/.nvm/versions/node/v21.5.0/bin/npm
Browsers:
Chrome: 129.0.6668.101
Safari: 18.0.1
npmPackages:
@uploadthing/svelte: ^7.0.3 => 7.0.3
typescript: ^5.6.3 => 5.6.3
uploadthing: ^7.1.0 => 7.1.0
Describe the bug
I can see that in the middleware, the request object is not the same shape as before. I tested it with the exact same code in hooks.server.ts which sets some locales. The new request object is actually a Sveltekit RequestEvent and is not typed correctly. It is no longer a standard web request.
This is an issue with the types of course but it also broke my authentication code which relied on the previous standard Request. It should be stated in the migration guide if this is intended and the types fixed.
.middleware(async ({ req }) => {
// This code runs on your server before upload
console.log('req:', req)
...
}
...
Provide environment information
Describe the bug
I can see that in the middleware, the request object is not the same shape as before. I tested it with the exact same code in hooks.server.ts which sets some locales. The new request object is actually a Sveltekit RequestEvent and is not typed correctly. It is no longer a standard web request.
This is an issue with the types of course but it also broke my authentication code which relied on the previous standard Request. It should be stated in the migration guide if this is intended and the types fixed.
Old request:
New request (you can see locals I set from hooks.server.ts now):
Link to reproduction
None provided!
To reproduce
Check type mismatch of req in middleware on Sveltekit with uploadthing 7.XX
Additional information
No response
๐จโ๐งโ๐ฆ Contributing
Code of Conduct