Open hamzzy opened 1 month ago
@aBurmeseDev
Hi @hamzzy - thanks for your patience.
It appears that the error you're seeing comes from @mswjs/interceptors library, which is used for mocking HTTP requests during testing. This library seems to be intercepting the request made by the PutObjectCommand
and attempting to mock the response, but it's encountering an issue with the response status code.
The error message suggests that the mocked response is attempting to set an invalid status code. This could be due to a configuration issue or a bug in the library itself, rather than SDK.
To narrow down the root cause, you can try disabling the library/interceptor for the request that's causing the issue. You can do this by modifying your test setup or configuration to exclude the PutObjectCommand
from being intercepted.
Check if you have the latest version of @mswjs/interceptors: Sometimes, issues like this are resolved in newer versions of the library. Reach out to https://github.com/mswjs/interceptors/issues.
It's worth noting that this error is likely related to the mocking library and not the AWS SDK itself, as the SDK should handle the request and response correctly when interacting with the actual AWS S3 service.
Checkboxes for prior research
Describe the bug
If I use an empty body, the code executes without issues. However, when I attach a file buffer to the body, I encounter the following error:
SDK version number
@aws-sdk/client-s3 ^3.629.0
Which JavaScript Runtime is this issue in?
Node.js
Details of the browser/Node.js/ReactNative version
20.0.0
Reproduction Steps
Observed Behavior
Expected Behavior
it should successfully upload the file to Cloudflare r2
Possible Solution
No response
Additional Information/Context
No response