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

TypeError: Cannot add property config, object is not extensible at _FetchHttpHandler.handle #5987

Closed
3 tasks done
prasid444-niural opened this issue Apr 10, 2024 · 3 comments
Assignees
Labels
bug This issue is a bug. closed-for-staleness p3 This is a minor priority issue response-requested Waiting on additional info and feedback. Will move to \"closing-soon\" in 7 days.

Comments

@prasid444-niural
Copy link

prasid444-niural commented Apr 10, 2024

Checkboxes for prior research

Describe the bug

While uploading a file to s3, it gives Typeerror. But this happens only when I do yarn start and is working correctly in build and serve. This is when using vite, it was working on CRA.

error message:

VM8:1 TypeError: Cannot add property config, object is not extensible
    at _FetchHttpHandler.handle (@aws-sdk_client-s3.js?v=275400b4:6965:19)
    at async @aws-sdk_client-s3.js?v=275400b4:21097:18
    at async @aws-sdk_client-s3.js?v=275400b4:10401:24

SDK version number

@aws-sdk/client-s3@3.470.0

Which JavaScript Runtime is this issue in?

Browser

Details of the browser/Node.js/ReactNative version

Chrome: 123.0.6312.107 Safari: 17.4.1

Reproduction Steps

    try {
      const s3 = await getS3(); //gets new S3Client() 
      const putObjectCommand = new PutObjectCommand({
        Bucket: "",
        Key: "file path",
        Body: file, //file object
      });
      console.log("came here")
      await s3.send( putObjectCommand);
      console.log("not here, above line throw error")
    //should return success i.e new file
    } catch (error) {
      console.log(error); //this gave typeerror
      throw new Error("File upload failed. Removing file.");
    }

Observed Behavior

VM8:1 TypeError: Cannot add property config, object is not extensible
    at _FetchHttpHandler.handle (@aws-sdk_client-s3.js?v=275400b4:6965:19)
    at async @aws-sdk_client-s3.js?v=275400b4:21097:18
    at async @aws-sdk_client-s3.js?v=275400b4:10401:24

It seems the send method is trying to extend the argument provided which failed to extend the property config possibly due to use strict mode.

Expected Behavior

It should not throw any Typeerror and file should be uploaded successfully as it is done in build mode.

Possible Solution

Either the argument should be extensible by default or we may should be able to configure if strict mode should be removed or not [but I guess this should not be done].

Additional Information/Context

No response

@prasid444-niural prasid444-niural added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Apr 10, 2024
@prasid444-niural
Copy link
Author

Any updates in this?

@aBurmeseDev aBurmeseDev self-assigned this Apr 23, 2024
@aBurmeseDev aBurmeseDev added investigating Issue is being investigated and/or work is in progress to resolve the issue. and removed needs-triage This issue or PR still needs to be triaged. labels Apr 23, 2024
@aBurmeseDev
Copy link
Member

Hi @prasid444-niural - thanks for reaching out.

I tried to reproduce it with code snippet below, similar to yours but was unable to. I noticed you mentioned that this only occurs when using Vite. Can you share necessary steps to reproduce with Vite? Also I can't tell as your code snippet is incomplete, can you verify how you're configuring your credentials, region and such?

 import { S3Client, PutObjectCommand } from "@aws-sdk/client-s3";

try {
const client = new S3Client({
    region: "us-west-1"
});
const putObjectCommand = new PutObjectCommand({
    Bucket: "uploadtest",
    Body: "test.xml",
    Key: "test.xml",
})

await client.send(putObjectCommand);
} catch (error) {
    console.log(error)
}

Best,
John

@aBurmeseDev aBurmeseDev added response-requested Waiting on additional info and feedback. Will move to \"closing-soon\" in 7 days. p3 This is a minor priority issue and removed investigating Issue is being investigated and/or work is in progress to resolve the issue. labels Apr 23, 2024
Copy link

github-actions bot commented May 4, 2024

This issue has not received a response in 1 week. If you still think there is a problem, please leave a comment to avoid the issue from automatically closing.

@github-actions github-actions bot added closing-soon This issue will automatically close in 4 days unless further comments are made. closed-for-staleness and removed closing-soon This issue will automatically close in 4 days unless further comments are made. labels May 4, 2024
@github-actions github-actions bot closed this as completed May 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue is a bug. closed-for-staleness p3 This is a minor priority issue response-requested Waiting on additional info and feedback. Will move to \"closing-soon\" in 7 days.
Projects
None yet
Development

No branches or pull requests

2 participants