Simon Reilly
05/12/2021, 7:17 AMFrank
sst start
should use the IAM credentials of the Lambda function.Frank
Simon Reilly
05/13/2021, 7:32 AMFrank
is not authorized to perform: dynamodb:PutItem
error in both cases.Simon Reilly
05/13/2021, 9:50 AMnpx sst start
. Perhaps I was just doing it wrong?Frank
npx sst start
Simon Reilly
05/13/2021, 9:53 AMAWS_PROFILE=cgu npx sst start
to use a local profile. Is this potentially what is causing my issue?Frank
Frank
console.log(process.env)
in ur Lambda code?Frank
sst start
console, see if you spot AWS_ACCESS_KEY_ID
, AWS_SECRET_ACCESS_KEY
, and AWS_SESSION_TOKEN
Simon Reilly
05/13/2021, 10:20 AMSimon Reilly
05/13/2021, 11:52 AMFrank
AccessDenied
error.Frank
getCallerIdentity
or getAccessKeyInfo
to verify the IAM credentials the sdk is using
• does the Lambda have other non-dynamodb permissions? (ie. make an aws sdk call to list out all SNS topics)Simon Reilly
05/14/2021, 6:34 AMAWS_PROFILE
env var is present inside the lambdas, and they are preferentially using the credentials attached to that profile
I have updated my bug report with my operating system, a PR that shows using delete(process.env.AWS_PROFILE)
fixes this issue, and also a GIF of the issue happening when I deploy with AWS_PROFILE=cgu npx sst start
It is worth mentioning now that I would usually deploy the cdk like so: npx cdk deploy --profile cgu
this does not set the env var I believe.
I do not think the sst supports this yet:
$ npx sst start --profile cgu
=======================
Deploying debug stack
=======================
✅ dev-sst-tester-debug-stack (no changes)
Stack dev-sst-tester-debug-stack
Status: no changes
Outputs:
BucketArn: arn:aws:s3:::dev-sst-tester-debug-stack-bucket83908e77-8oy8jd2stedi
BucketName: dev-sst-tester-debug-stack-bucket83908e77-8oy8jd2stedi
Endpoint: <wss://e4y2ztj41b.execute-api.eu-west-1.amazonaws.com/dev>
===============
Deploying app
===============
Preparing your SST app
Detected tsconfig.json
Transpiling source
Linting source
Running type checker
Deploying stacks
AccessDenied: User: arn:aws:iam::347250048819:user/simon.reilly is not authorized to perform: cloudformation:DescribeStacks on resource: arn:aws:cloudformation:eu-west-1:347250048819:stack/dev-sst-tester-my-stack/*
at Request.extractError (/home/simon/code/projects/sst-tester/node_modules/aws-sdk/lib/protocol/query.js:50:29)
at Request.callListeners (/home/simon/code/projects/sst-tester/node_modules/aws-sdk/lib/sequential_executor.js:106:20)
at Request.emit (/home/simon/code/projects/sst-tester/node_modules/aws-sdk/lib/sequential_executor.js:78:10)
at Request.emit (/home/simon/code/projects/sst-tester/node_modules/aws-sdk/lib/request.js:688:14)
at Request.transition (/home/simon/code/projects/sst-tester/node_modules/aws-sdk/lib/request.js:22:10)
at AcceptorStateMachine.runTo (/home/simon/code/projects/sst-tester/node_modules/aws-sdk/lib/state_machine.js:14:12)
at /home/simon/code/projects/sst-tester/node_modules/aws-sdk/lib/state_machine.js:26:10
at Request.<anonymous> (/home/simon/code/projects/sst-tester/node_modules/aws-sdk/lib/request.js:38:9)
at Request.<anonymous> (/home/simon/code/projects/sst-tester/node_modules/aws-sdk/lib/request.js:690:12)
at Request.callListeners (/home/simon/code/projects/sst-tester/node_modules/aws-sdk/lib/sequential_executor.js:116:18) {
code: 'AccessDenied',
time: 2021-05-14T06:33:12.517Z,
requestId: '281d9599-badf-4202-bf0e-5c843564c744',
statusCode: 403,
retryable: false,
retryDelay: 16.820242262488392
}
❌ dev-sst-tester-my-stack failed: AccessDenied: User: arn:aws:iam::347250048819:user/simon.reilly is not authorized to perform: cloudformation:DescribeStacks on resource: arn:aws:cloudformation:eu-west-1:347250048819:stack/dev-sst-tester-my-stack/*
Stack dev-sst-tester-my-stack
Status: failed
Error: User: arn:aws:iam::347250048819:user/simon.reilly is not authorized to perform: cloudformation:DescribeStacks on resource: arn:aws:cloudformation:eu-west-1:347250048819:stack/dev-sst-tester-my-stack/*
Failed to deploy the app
Frank
AWS_PROFILE
might be the culprit. I removed it from the npm scripts when I cloned ur repo, which in the hindsight was dumb. I should’ve tried ur EXACT setup.Frank
Simon Reilly
05/15/2021, 2:44 PMFrank
Frank
Simon Reilly
05/20/2021, 5:57 AM