Open menkari opened 2 months ago
yeah @africanobyamugisha I'm pretty sure sending someone a random zip file ain't the solution bro 🤪
Hey @menkari ,
Thanks for the feedback! However I can't reproduce this issue. Code I have :
import { S3Client, ListObjectsCommand } from "@aws-sdk/client-s3";
// Create an S3 client
var config = {
region: "us-east-1",
credentials: {
accessKeyId: "***",
secretAccessKey: "***",
},
};
const client = new S3Client(config);
var bucketParams = { Bucket: "new-bucket-maggie-ma" };
var listObjectsCommand = new ListObjectsCommand(bucketParams);
client
.send(listObjectsCommand)
.then(function (data) {
console.log("Success", data);
})
.catch(function (err) {
console.error(err);
});
In order to find the root cause, could you please send over the parameters that you put on the ListBucketsCommand
?
Thanks! Maggie
@zshzbh Its every command, not just ListBucketsCommand
- As I understand, the command doesn't require any parameters anyway. But even with the most basic of GetObjectCommand
const response = this.s3Client.send(new GetObjectCommand({
Bucket: 'my-bucket',
Key: 'my-key'}
}));
Also returns the type error of
Argument type GetObjectCommand is not assignable to parameter type Command<ServiceInputTypes, SI, ServiceOutputTypes, SO, SmithyResolvedConfiguration<__HttpHandlerOptions>>
I've pushed the minimal application here for cloning: https://github.com/neon-light-dev/awsTester
Hey @menkari,
I put ListObjectsCommand
in my repro code and it does require parameters -
import { S3Client, ListObjectsCommand } from "@aws-sdk/client-s3"; // ES Modules import
// const { S3Client, ListObjectsCommand } = require("@aws-sdk/client-s3"); // CommonJS import
const client = new S3Client(config);
const input = { // ListObjectsRequest
Bucket: "STRING_VALUE", // required
Delimiter: "STRING_VALUE",
EncodingType: "url",
Marker: "STRING_VALUE",
MaxKeys: Number("int"),
Prefix: "STRING_VALUE",
RequestPayer: "requester",
ExpectedBucketOwner: "STRING_VALUE",
OptionalObjectAttributes: [ // OptionalObjectAttributesList
"RestoreStatus",
],
};
Could you please delete the lock file and node modules and reinstall the latest sdk version ?
Checkboxes for prior research
Describe the bug
Brand new application, I'm receiving argument type errors when instantiating the
S3Client
and assigning any operation to the.send()
function.new S3Client error:
Argument type {region: string} is not assignable to parameter type __CheckOptionalClientConfig<S3ClientConfig>
.send() command error:
Argument type ListBucketsCommand is not assignable to parameter type Command<ServiceInputTypes, SI, ServiceOutputTypes, SO, SmithyResolvedConfiguration<__HttpHandlerOptions>>
SDK version number
@aws-sdk/client-s3@3.637.0
Which JavaScript Runtime is this issue in?
Browser
Details of the browser/Node.js/ReactNative version
v20.16.0
Reproduction Steps
This looks to be a continuation of #4928
Minimally reproducible application using Angular 18 via ng-cli, vanilla setup, SCSS.
home.component.ts
package.json
Observed Behavior
Unable to compile the application due to argument type errors
Expected Behavior
The application should function according to API documentation with the prescribed types.
Possible Solution
Unknown. Have seen this issue previously. Fixes weren't conveyed. Have attempted
package.json
lock file andnode-modules
folder delete. Have started from scratch with no success either.Additional Information/Context
Currently using webstorm, macos