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

Error occurred while GetObject. S3 Error Code: NoSuchBucket. S3 Error Message: The specified bucket does not exist (Service: AWSLambdaInternal; Status Code: 400; Error Code: InvalidParameterValueException; Request ID: d19f49eb-9da6-11e9-bfe6-2bd79cd1146a) #115

Closed
malikkamranabid opened this issue Jul 3, 2019 · 18 comments

Comments

@malikkamranabid
Copy link

I am getting this issue however i tried to launch a stack with in same region. But still getting can you provide me an example how do i create bucket. This line mentioned below in readme is confusing as well

Note: You would have to create 2 buckets, one named 'my-bucket-name' and another regional bucket named 'my-bucket-name-<aws_region>'; aws_region is where you are testing the customized solution. Also, the assets in bucket should be publicly accessible.

  • should i create two bucket in same region ?
  • for example one bucket name is test-bucket. If region is ap-east-1 then another bucket name should be test-bucket-ap-east-1 ?
@jasonobrown
Copy link

We are having the exact same issue. I don't understand the need for 2 buckets either. In fact, it doesn't seem like the bucket without the region code is ever actually used. Here's why:

The readme says:
export TEMPLATE_OUTPUT_BUCKET=my-bucket-name # bucket where cfn template will reside
export DIST_OUTPUT_BUCKET=my-bucket-name # bucket where customized code will reside
export VERSION=my-version # version number for the customized code

and then:
aws s3 cp ./dist/ s3://$DIST_OUTPUT_BUCKET-[region_name]/serverless-image-handler/$VERSION/ --recursive --exclude "" --include ".zip"
aws s3 cp ./dist/serverless-image-handler.template s3://$TEMPLATE_OUTPUT_BUCKET/serverless-image-handler/$VERSION/

Now, I'm assuming we're supposed to create 2 buckets and name them like this:
export TEMPLATE_OUTPUT_BUCKET=my-bucket-name-us-east-2
export DIST_OUTPUT_BUCKET=my-bucket-name

Assuming that's correct, the only bucket being used is my-bucket-name-us-east-2 because this is basically making TEMPLATE_OUTPUT_BUCKET = DIST_OUTPUT_BUCKET when you upload them:
aws s3 cp ./dist/ s3://$DIST_OUTPUT_BUCKET-[region_name]/serverless-image-handler/$VERSION/ --recursive --exclude "" --include ".zip"
aws s3 cp ./dist/serverless-image-handler.template s3://$TEMPLATE_OUTPUT_BUCKET/serverless-image-handler/$VERSION/

@malikkamranabid
Copy link
Author

yes i tried number of times issues remains the same. I use js library sharp to implement this. Let me know if you need my help

@jasonobrown
Copy link

Also, in order to get the build to work properly we had to remove the empty quotes from lines 16, 19 and 22 of /deployment/build-s3-dist.sh (sed -i '' -e $replace dist/*.template). As far as I can tell the empty quotes are not proper for sed and shouldn't be there. We are building (as suggested) on an amazon linux machine with all proper requirements installed and configured.

@jasonobrown
Copy link

@malikkamranabid YES!!! If you found a way to implement this that would be great! I'd appreciate any help you can give!

@malikkamranabid
Copy link
Author

my skype id is [email protected]
we can discuss it there

@hayesry
Copy link
Member

hayesry commented Aug 5, 2019

Hello all, please let me know if you're still experiencing trouble with the solution build/configuration process and I'd be happy to help where possible!

@pputra
Copy link

pputra commented Aug 12, 2019

I'm still having this exact same issue, please help, thank you.

@bradleyayers
Copy link

My issue ended up being that I didn’t read the README properly and misunderstood how the bucket names work, and in particular that the bucket name is really just the prefix, and the region is appended as a suffix.

@tdmrut
Copy link

tdmrut commented Sep 30, 2019

I have same issue, please let me know if you have any solution. Thanks

@rapitivo
Copy link

rapitivo commented Oct 1, 2019

I have found the problem. I found the README a bit confused.

  1. DIST_OUTPUT_BUCKET and TEMPLATE_OUTPUT_BUCKET use the same value, without add the region in any of them.
  2. Create 2 buckets one using the name in the variables above and another one adding the region at the end.
  3. Build it and upload

@aijunpeng
Copy link
Member

Hello, thanks for your questions. Just to clarify, you will need to create two s3 buckets in the same region for storing customized source code and CloudFormation template, for example "my-test-bucket"(for storing customized source code) and "my-test-bucket-us-east-1" (for storing CloudFormation template). You will also need to export these two buckets as environment variables, for example export DIST_OUTPUT_BUCKET=my-test-bucket and export TEMPLATE_OUTPUT_BUCKET= my-test-bucket-us-east-1. Then the value of the environment variables (bucket names) will be used to replace the variables in CloudFormation template in the steps later on and code will be copied to these two s3 buckets via s3 cp commands. Please follow the steps in README- Building distributable for customization to build and configure the solutions. Thanks!

@aijunpeng
Copy link
Member

Sorry, DIST_OUTPUT_BUCKET and TEMPLATE_OUTPUT_BUCKET should be the other way around. Below is the correction :

Create two s3 buckets in the same region for storing customized source code and CloudFormation template, for example "my-test-bucket"(for storing CloudFormation template ) and "my-test-bucket-us-east-1" (for storing customized source code). You will also need to export these two buckets as environment variables, for example export DIST_OUTPUT_BUCKET=my-test-bucket-us-east-1 and export TEMPLATE_OUTPUT_BUCKET= my-test-bucket. Then the value of the environment variables (bucket names) will be used to replace the variables in CloudFormation template in the steps later on and code will be copied to these two s3 buckets via s3 cp commands. Please follow the steps in README- Building distributable for customization to build and configure the solutions.

@dvcsit-cci
Copy link

I am also facing the same problem. I followed the suggestions given above but it didn't work.

@mberneis
Copy link

mberneis commented Oct 24, 2019

I finally solved the bucket naming problem with all the advice above but am now encountering the following error in the cloudformation process in the ID ImageHandlerFunction:

Error occurred while GetObject. S3 Error Code: NoSuchKey. S3 Error Message: The specified key does not exist. (Service: AWSLambdaInternal; Status Code: 400; Error Code: InvalidParameterValueException; Request ID: ae9e74a0-f5e3-4fc5-b47d-dfe339f1e7e3)
--
Any advice what the issue could be?


@ericquinones
Copy link

I finally solved the bucket naming problem with all the advice above but am now encountering the following error in the cloudformation process in the ID ImageHandlerFunction:

Error occurred while GetObject. S3 Error Code: NoSuchKey. S3 Error Message: The specified key does not exist. (Service: AWSLambdaInternal; Status Code: 400; Error Code: InvalidParameterValueException; Request ID: ae9e74a0-f5e3-4fc5-b47d-dfe339f1e7e3)
--
Any advice what the issue could be?

Hi there,
Are you still experiencing this issue? If so, to help troubleshoot a bit, can you please have a look at the serverless-image-handler.template file that should have been created in deployment/dist/ after this step in the readme: sudo ./build-s3-dist.sh $DIST_OUTPUT_BUCKET $VERSION.

Inside the template, you should be able to find the definition for ImageHandlerFunction within the Resources object. Please have a look at where the Lambda's code should be found (JSONPath: $.Resources.ImageHandlerFunction.Properties.Code). CloudFormation is instructed to derive the bucket containing the Lambda's function by joining $.Mappings.SourceCode.General.S3Bucket with the Region in which you are currently deploying this CloudFormation template. The value for $.Mappings.SourceCode.General.S3Bucket should be the value you used for the DIST_OUTPUT_BUCKET environment variable.

If your Mappings are defined as below and you deployed the CloudFormation stack in us-east-1, CloudFormation will attempt to find your code in this bucket: my-bucket-name-us-east-1

    "Mappings": { 
        "SourceCode": { 
            "General": { 
                "S3Bucket": "my-bucket-name", 
                "KeyPrefix": "serverless-image-handler/v0.0.1" 
            } 
        } 
    }, 

The object key that CloudFormation will attempt to use is defined in this JSONPath: $.Resources.ImageHandlerFunction.Properties.Code.S3Key. Note the version should be the value you set as the $VERSION environment variable before running the build script.

Can you please try to manually check S3 to verify that the image-handler.zip file is in the correct S3 location that CloudFormation will use during the stack launch?

@beomseoklee
Copy link
Member

We are closing this issue, but please feel free to open the issue again if you any other support.

@andersontechnetverrum
Copy link

I am facing the same issue above: encountering the following error in the cloudformation process in the ID SFTPCustomAuthLambda:

Resource handler returned message: "Error occurred while GetObject. S3 Error Code: NoSuchBucket. S3 Error Message: The specified bucket does not exist (Service: Lambda, Status Code: 400, Request ID: c9c29b9b-63f6-41f4-bf93-4958c68b863c)" (RequestToken: ad6458fc-c648-8612-e8cf-2c961834290a, HandlerErrorCode: InvalidRequest)

Any advice what the issue could be?

@dougtoppin
Copy link
Contributor

@andersontechnetverrum thanks for your report, please provide the following additional information

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests