s3.Bucket.import Type Error
See original GitHub issueDescribe the bug s3.Bucket.import is throwing a type error. Did something change? All the docs I can find including the source code docs make it seem like this should work.
To Reproduce
import * as s3 from '@aws-cdk/aws-s3'
export class AppStack extends cdk.Stack {
constructor(scope: cdk.Construct, id: string, props?: cdk.StackProps) {
super(scope, id, props)
const bucket = s3.Bucket.import(this, {
bucketArn: `arn:aws:s3:::bucket-name`
})
}
}
const app = new cdk.App()
Expected behavior No type error
Version:
- OS OSX
- Programming Language Node.JS+Typescript
- CDK Version 0.33.0
Issue Analytics
- State:
- Created 4 years ago
- Comments:10 (2 by maintainers)
Top Results From Across the Web
Resolve S3 error while creating import in Personalize
This error occurs when Amazon Personalize can't read the data in the input bucket due to insufficient Amazon Simple Storage Service (Amazon S3) ......
Read more >Unable to terraform import s3 bucket state
You have to specify instance index which you are importing as you are using count and also use a bucket name, e.g.
Read more >Troubleshoot Access Denied Errors during Data Import ...
This document describes how to troubleshoot access denied errors that might occur when you import data from Amazon S3 into TiDB Cloud.
Read more >Importing Existing Cloud Infrastructure
Type Name Plan + pulumi:pulumi:Stack import-post-dev create = └─ aws:s3:Bucket infra-logs import Resources: + 1 to create = 1 to import 2 changes....
Read more >Imports and File Transfer activities using AWS S3 File ...
If an activity using an AWS S3 bucket returns the "File ... not found" error, eliminate other possible causes of the error, ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Shouldn’t it actually be:
const bucket: Bucket = s3.Bucket.fromBucketArn(this, 'importedBucketFromARN', 'someBucketArn')
Rather in reality its:
const bucket: IBucket = s3.Bucket.fromBucketArn(this, 'importedBucketFromARN', 'someBucketArn')
Why wouldn’t
fromBucketArn
return the Class/an instance rather than the Interface? With it returning the IBucket Interface it makes it impossible to “import” a bucket from another nested stack, thus creating circular dependencies.Does anyone have a workaround for this?
The inline doc is clearly outdated/incorrect here.