question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

s3.Bucket.import Type Error

See original GitHub issue

Describe 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:closed
  • Created 4 years ago
  • Comments:10 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
rmichaelbcommented, Jan 22, 2020

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?

1reaction
RomainMullercommented, Jun 26, 2019

The inline doc is clearly outdated/incorrect here.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found