mantil-io / mantil

Build your AWS Lambda-based Go backends quicker than ever
https://www.mantil.com
MIT License
109 stars 3 forks source link

Add better error message when functions are not deployed #73

Closed ianic closed 2 years ago

ianic commented 3 years ago

Source of the problem is that I started aws install without deploying functions to s3.

It fails with:

mantil aws install --aws-profile org5
==> Installing setup stack...
Error: cloudformation failed

log:

2021/11/02 19:24:14.801539 /Users/ianic/mantil-io/mantil/cli/main.go:74: version: v0.1.13-32-gc86b621, args: [mantil aws install --aws-profile org5]
2021/11/02 19:24:15.423443 /Users/ianic/mantil-io/mantil/cli/controller/setup.go:83: [cli.Info] ==> Installing setup stack...
2021/11/02 19:25:15.885644 /Users/ianic/mantil-io/mantil/cli/cmd/root.go:189: [cli.Error] cloudformation failed
2021/11/02 19:25:15.886303 /Users/ianic/mantil-io/mantil/cli/main.go:76: [ERROR] cloudformation failed: could not create stack mantil-setup-d6khbiq - MantilSetupLambda - Resource handler returned message: "Yo
ur access has been denied by S3, please make sure your request credentials have permission to GetObject for mantil-releases/dev/ianic/v0.1.13-32-gc86b621/setup.zip. S3 Error Code: AccessDenied. S3 Error Messa
ge: Access Denied (Service: Lambda, Status Code: 403, Request ID: 41276beb-14f2-46d6-a45a-3349ed07e162, Extended Request ID: null)" (RequestToken: 41d65f09-0acc-296b-04d3-daa3e1c48270, HandlerErrorCode: Acces
sDenied)
1 cloudformation failed: could not create stack mantil-setup-d6khbiq - MantilSetupLambda - Resource handler returned message: "Your access has been denied by S3, please make sure your request credentials have
 permission to GetObject for mantil-releases/dev/ianic/v0.1.13-32-gc86b621/setup.zip. S3 Error Code: AccessDenied. S3 Error Message: Access Denied (Service: Lambda, Status Code: 403, Request ID: 41276beb-14f2
-46d6-a45a-3349ed07e162, Extended Request ID: null)" (RequestToken: 41d65f09-0acc-296b-04d3-daa3e1c48270, HandlerErrorCode: AccessDenied)
        github.com/mantil-io/mantil/cli/cmd.newAwsInstallCommand.func1
        /Users/ianic/mantil-io/mantil/cli/cmd/commands.go:61
2 cloudformation failed: could not create stack mantil-setup-d6khbiq - MantilSetupLambda - Resource handler returned message: "Your access has been denied by S3, please make sure your request credentials have permission to GetObject for mantil-releases/dev/ianic/v0.1.13-32-gc86b621/setup.zip. S3 Error Code: AccessDenied. S3 Error Message: Access Denied (Service: Lambda, Status Code: 403, Request ID: 41276beb-14f2-46d6-a45a-3349ed07e162, Extended Request ID: null)" (RequestToken: 41d65f09-0acc-296b-04d3-daa3e1c48270, HandlerErrorCode: AccessDenied)
        github.com/mantil-io/mantil/cli/controller.(*Setup).Create
        /Users/ianic/mantil-io/mantil/cli/controller/setup.go:67
3 cloudformation failed: could not create stack mantil-setup-d6khbiq - MantilSetupLambda - Resource handler returned message: "Your access has been denied by S3, please make sure your request credentials have permission to GetObject for mantil-releases/dev/ianic/v0.1.13-32-gc86b621/setup.zip. S3 Error Code: AccessDenied. S3 Error Message: Access Denied (Service: Lambda, Status Code: 403, Request ID: 41276beb-14f2-46d6-a45a-3349ed07e162, Extended Request ID: null)" (RequestToken: 41d65f09-0acc-296b-04d3-daa3e1c48270, HandlerErrorCode: AccessDenied)
        github.com/mantil-io/mantil/cli/controller.(*Setup).create
        /Users/ianic/mantil-io/mantil/cli/controller/setup.go:85
4 cloudformation failed: could not create stack mantil-setup-d6khbiq - MantilSetupLambda - Resource handler returned message: "Your access has been denied by S3, please make sure your request credentials have permission to GetObject for mantil-releases/dev/ianic/v0.1.13-32-gc86b621/setup.zip. S3 Error Code: AccessDenied. S3 Error Message: Access Denied (Service: Lambda, Status Code: 403, Request ID: 41276beb-14f2-46d6-a45a-3349ed07e162, Extended Request ID: null)" (RequestToken: 41d65f09-0acc-296b-04d3-daa3e1c48270, HandlerErrorCode: AccessDenied)
        github.com/mantil-io/mantil/cli/controller.(*Setup).createSetupStack
        /Users/ianic/mantil-io/mantil/cli/controller/setup.go:124
5 could not create stack mantil-setup-d6khbiq - MantilSetupLambda - Resource handler returned message: "Your access has been denied by S3, please make sure your request credentials have permission to GetObject for mantil-releases/dev/ianic/v0.1.13-32-gc86b621/setup.zip. S3 Error Code: AccessDenied. S3 Error Message: Access Denied (Service: Lambda, Status Code: 403, Request ID: 41276beb-14f2-46d6-a45a-3349ed07e162, Extended Request ID: null)" (RequestToken: 41d65f09-0acc-296b-04d3-daa3e1c48270, HandlerErrorCode: AccessDenied)
        github.com/mantil-io/mantil/aws.(*CloudFormation).CreateStack
        /Users/ianic/mantil-io/mantil/aws/cloudformation.go:60
ianic commented 2 years ago

It's pretty much ok in the current version:

mantil aws install --aws-profile org5

Installing setup stack: 50% (2/4)
Error: could not create stack mantil-setup-41c1c71b - MantilSetupLambda - Resource handler returned message: "Your access has been denied by S3, please make sure your request credentials have permission to GetObject for mantil-releases/dev/ianic/v0.2.6-1-g5b160c2/setup.zip. S3 Error Code: AccessDenied. S3 Error Message: Access Denied (Service: Lambda, Status Code: 403, Request ID: a552d1e7-ebd5-4630-bb3a-18fcca7691e6, Extended Request ID: null)" (RequestToken: 9bd05575-59a3-8609-35f0-8f65588300b5, HandlerErrorCode: AccessDenied)
Error: installing setup stack failed

This error is only shown in development when a developer is running non released Mantil version and didn't make deploy which creates S3 objects required for creating node. From S3 we get access denied but we all know that means object not found ;).