-
Notifications
You must be signed in to change notification settings - Fork 73
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
function access to s3 bucket does not work #1769
Comments
Hey @yegenpres, thank you for reaching out and providing the information. Are you passing the path as part of the key in the PutObjectCommand params? Reproduction steps:
with the path:
without the path
From the documentation: https://docs.amplify.aws/react/build-a-backend/functions/grant-access-to-other-resources/#using-the-access-property |
Closing the issue due to inactivity. Do reach out to us if you are still experiencing this issue. |
I was able to reproduce this error with a Gen 2 project created within the last month. A Vue app calls an API Gateway, which invokes a Lambda. All is well until the Lambda tries to PUT content the user posted to the S3 bucket at a correctly-prefixed key that it should have access to. CloudWatch logs follow. Echoing the S3 Put Command Options just before using them...
Error from attempting to PUT to S3...
This project using the access property to authorize the Lambda, and to share the bucket name with the Lambda; just as described in the Amplify Gen 2 docs. Relevant source code follows... $ npx ampx info
System:
OS: Linux 6.5 Ubuntu 22.04.4 LTS 22.04.4 LTS (Jammy Jellyfish)
CPU: (6) x64 Intel(R) Core(TM) i7-8750H CPU @ 2.20GHz
Memory: 12.67 GB / 19.52 GB
Shell: /bin/bash
Binaries:
Node: 20.15.1 - ~/.nvm/versions/node/v20.15.1/bin/node
Yarn: undefined - undefined
npm: 10.8.2 - ~/.nvm/versions/node/v20.15.1/bin/npm
pnpm: undefined - undefined
NPM Packages:
@aws-amplify/auth-construct: 1.2.0
@aws-amplify/backend: 1.0.4
@aws-amplify/backend-auth: 1.1.1
@aws-amplify/backend-cli: 1.2.2
@aws-amplify/backend-data: 1.1.0
@aws-amplify/backend-deployer: 1.0.3
@aws-amplify/backend-function: 1.3.0
@aws-amplify/backend-output-schemas: 1.1.0
@aws-amplify/backend-output-storage: 1.0.2
@aws-amplify/backend-secret: 1.0.0
@aws-amplify/backend-storage: 1.0.4
@aws-amplify/cli-core: 1.1.1
@aws-amplify/client-config: 1.1.2
@aws-amplify/deployed-backend-client: 1.2.0
@aws-amplify/form-generator: 1.0.0
@aws-amplify/model-generator: 1.0.3
@aws-amplify/platform-core: 1.0.4
@aws-amplify/plugin-types: 1.1.0
@aws-amplify/sandbox: 1.1.1
@aws-amplify/schema-generator: 1.2.0
aws-amplify: 6.5.0
aws-cdk: 2.151.0
aws-cdk-lib: 2.150.0
typescript: 5.5.4
AWS environment variables:
AWS_STS_REGIONAL_ENDPOINTS = regional
AWS_NODEJS_CONNECTION_REUSE_ENABLED = 1
AWS_SDK_LOAD_CONFIG = 1
No CDK environment variables Thanks for looking into this! If y'all have any suggestions on how to troubleshoot or work around, I'd be glad to hear them! |
Initially, I was unable to use the workaround reported in this issue because I couldn't find a way to access the bucket name in that approach. I was able to make it work after manually adding the bucket name. Workaround here: carlschroedl/ubiquitous-robot@535b57b |
Environment information
Description
that is code snippet from lambda:
Can not assign access to s3 bucket from lambda function:
I have tries both ways of doing from documentation: https://docs.amplify.aws/swift/build-a-backend/functions/grant-access-to-other-resources/
way one:
way two:
Only second way of doing works well.
So it looks like if I need to define some external services permission then s3 permission from way 1 does not work, and I need add it also in way 2.
It looks very not obviously.
For 2 weeks of using Amplify 2get it is third bar which I report.
The text was updated successfully, but these errors were encountered: