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

dotnet lambda deploy-serverless fails, object reference error #266

Closed
menasheh opened this issue Apr 20, 2018 · 4 comments
Closed

dotnet lambda deploy-serverless fails, object reference error #266

menasheh opened this issue Apr 20, 2018 · 4 comments
Labels
bug This issue is a bug. closed-for-staleness module/aspnetcore-support response-requested Waiting on additional info and feedback. Will move to close soon in 7 days.

Comments

@menasheh
Copy link

menasheh commented Apr 20, 2018

I've made a new project based on the LambdaASP.NETCoreWebAPI template.

I'm trying to get the template application deployed before I spend time developing my API, and it's throwing this error. See full terminal output below.

Versions:
Ubuntu: 17.10
dotnet: 2.1.105
IDE - Rider 2018.1

menasheh@oscar:~/projects/aws-test/LambdaASP.NETCoreWebAPI$ cd LambdaASP.NETCoreWebAPI/src/LambdaASP.NETCoreWebAPI/
menasheh@oscar:~/projects/aws-test/LambdaASP.NETCoreWebAPI/LambdaASP.NETCoreWebAPI/src/LambdaASP.NETCoreWebAPI$ dotnet lambda deploy-serverless
AWS Lambda Tools for .NET Core functions (2.1.1)
Project Home: https://github.com/aws/aws-lambda-dotnet
        
Enter CloudFormation Stack Name: (CloudFormation stack name for an AWS Serverless application)
test-stack
Enter S3 Bucket: (S3 bucket to upload the build output)
test-s3-test-test8
Enter AWS Region: (The region to connect to AWS services, if not set region will be detected from the environment)
us-east-1
Executing publish command
Deleted previous publish folder
... invoking 'dotnet publish', working folder '/home/menasheh/projects/aws-test/LambdaASP.NETCoreWebAPI/LambdaASP.NETCoreWebAPI/src/LambdaASP.NETCoreWebAPI/bin/Release/netcoreapp2.0/publish'
... publish: Microsoft (R) Build Engine version 15.6.84.34536 for .NET Core
... publish: Copyright (C) Microsoft Corporation. All rights reserved.
... publish:   Restore completed in 77.35 ms for /home/menasheh/projects/aws-test/LambdaASP.NETCoreWebAPI/LambdaASP.NETCoreWebAPI/src/LambdaASP.NETCoreWebAPI/LambdaASP.NETCoreWebAPI.csproj.
... publish:   Restore completed in 77.35 ms for /home/menasheh/projects/aws-test/LambdaASP.NETCoreWebAPI/LambdaASP.NETCoreWebAPI/src/LambdaASP.NETCoreWebAPI/LambdaASP.NETCoreWebAPI.csproj.
... publish:   Restoring packages for /home/menasheh/projects/aws-test/LambdaASP.NETCoreWebAPI/LambdaASP.NETCoreWebAPI/src/LambdaASP.NETCoreWebAPI/LambdaASP.NETCoreWebAPI.csproj...
... publish:   Restore completed in 1.7 sec for /home/menasheh/projects/aws-test/LambdaASP.NETCoreWebAPI/LambdaASP.NETCoreWebAPI/src/LambdaASP.NETCoreWebAPI/LambdaASP.NETCoreWebAPI.csproj.
... publish:   LambdaASP.NETCoreWebAPI -> /home/menasheh/projects/aws-test/LambdaASP.NETCoreWebAPI/LambdaASP.NETCoreWebAPI/src/LambdaASP.NETCoreWebAPI/bin/Release/netcoreapp2.0/linux-x64/LambdaASP.NETCoreWebAPI.dll
... publish:   LambdaASP.NETCoreWebAPI -> /home/menasheh/projects/aws-test/LambdaASP.NETCoreWebAPI/LambdaASP.NETCoreWebAPI/src/LambdaASP.NETCoreWebAPI/bin/Release/netcoreapp2.0/publish/
Changed permissions on published dll (chmod +r AWSSDK.Core.dll).
Changed permissions on published dll (chmod +r AWSSDK.S3.dll).
Changed permissions on published dll (chmod +r Amazon.Lambda.AspNetCoreServer.dll).
Changed permissions on published dll (chmod +r AWSSDK.Extensions.NETCore.Setup.dll).
Changed permissions on published dll (chmod +r Amazon.Lambda.Serialization.Json.dll).
Changed permissions on published dll (chmod +r LambdaASP.NETCoreWebAPI.dll).
Changed permissions on published dll (chmod +r Amazon.Lambda.Core.dll).
Changed permissions on published dll (chmod +r Amazon.Lambda.Logging.AspNetCore.dll).
Changed permissions on published dll (chmod +r Amazon.Lambda.APIGatewayEvents.dll).
Zipping publish folder /home/menasheh/projects/aws-test/LambdaASP.NETCoreWebAPI/LambdaASP.NETCoreWebAPI/src/LambdaASP.NETCoreWebAPI/bin/Release/netcoreapp2.0/publish to /home/menasheh/projects/aws-test/LambdaASP.NETCoreWebAPI/LambdaASP.NETCoreWebAPI/src/LambdaASP.NETCoreWebAPI/bin/Release/netcoreapp2.0/LambdaASP.NETCoreWebAPI.zip
... zipping:   adding: AWSSDK.Core.dll (deflated 66%)
... zipping:   adding: aws-lambda-tools-defaults.json (deflated 43%)
... zipping:   adding: AWSSDK.S3.dll (deflated 65%)
... zipping:   adding: LambdaASP.NETCoreWebAPI.runtimeconfig.json (deflated 30%)
... zipping:   adding: Amazon.Lambda.AspNetCoreServer.dll (deflated 60%)
... zipping:   adding: appsettings.json (deflated 23%)
... zipping:   adding: LambdaASP.NETCoreWebAPI.deps.json (deflated 85%)
... zipping:   adding: AWSSDK.Extensions.NETCore.Setup.dll (deflated 56%)
... zipping:   adding: Amazon.Lambda.Serialization.Json.dll (deflated 56%)
... zipping:   adding: LambdaASP.NETCoreWebAPI.dll (deflated 55%)
... zipping:   adding: LambdaASP.NETCoreWebAPI.pdb (deflated 45%)
... zipping:   adding: appsettings.Development.json (deflated 7%)
... zipping:   adding: web.config (deflated 35%)
... zipping:   adding: Amazon.Lambda.Core.dll (deflated 57%)
... zipping:   adding: Amazon.Lambda.Logging.AspNetCore.dll (deflated 56%)
... zipping:   adding: Amazon.Lambda.APIGatewayEvents.dll (deflated 60%)
Created publish archive (/home/menasheh/projects/aws-test/LambdaASP.NETCoreWebAPI/LambdaASP.NETCoreWebAPI/src/LambdaASP.NETCoreWebAPI/bin/Release/netcoreapp2.0/LambdaASP.NETCoreWebAPI.zip).
Uploading to S3. (Bucket: test-s3-test-test8 Key: LambdaASP.NETCoreWebAPI/test-stack-636598383011522588.zip)
... Progress: 23%
... Progress: 46%
... Progress: 69%
... Progress: 92%
... Progress: 100%
Uploading to S3. (Bucket: test-s3-test-test8 Key: LambdaASP.NETCoreWebAPI/test-stack-serverless-636598383014756405.template)
... Progress: 100%
Found existing stack: False
Template Parameters Applied:
        ShouldCreateBucket: true
        BucketName: 
CloudFormation change set created
... Waiting for change set to be reviewed
Created CloudFormation stack test-stack
   
Timestamp            Logical Resource Id                      Status                                   
-------------------- ---------------------------------------- ---------------------------------------- 
4/20/18 4:25 PM      test-stack                               CREATE_IN_PROGRESS                      
Unknown error executing AWS Serverless deployment: Object reference not set to an instance of an object.
   at Amazon.Lambda.Tools.Commands.DeployServerlessCommand.<WaitStackToCompleteAsync>d__71.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Amazon.Lambda.Tools.Commands.DeployServerlessCommand.<ExecuteAsync>d__67.MoveNext()
menasheh@oscar:~/projects/aws-test/LambdaASP.NETCoreWebAPI/LambdaASP.NETCoreWebAPI/src/LambdaASP.NETCoreWebAPI$ 

@menasheh
Copy link
Author

Giving the IAM user Admin rights fixed this problem.

That's probably not what I should do, anyway, though. What is the proper IAM config for a lambda serverless deployment IAM user?

@normj
Copy link
Member

normj commented Apr 26, 2018

Intersting. I agree you shouldn't not have to give admin permissions to deploy but this does give us some more information to help understand why it is failing for you.

@normj normj added the bug This issue is a bug. label Apr 26, 2018
@NGL321 NGL321 added the C label Oct 20, 2020
@ashishdhingra
Copy link
Contributor

ashishdhingra commented Feb 17, 2021

Hi @menasheh,

Good afternoon.

I was going through the backlog and came across this issue. Based on the research, at high level, in deploying your application, your IAM user will at least need permissions to:

  • Create an S3 bucket for your function deployments
  • Upload your function zip files to that S3 bucket
  • Submit a CloudFormation template
  • Create the log groups for your Lambda functions
  • Create a REST API in API Gateway
  • [any other permissions to create or provision other resources]

Hope this helps. Kindly confirm if you would be able to validate this for your scenario with non-Admin IAM User having relevant permissions.

I agree the deployment process should give appropriate error message though.

Thanks,
Ashish

@ashishdhingra ashishdhingra added the response-requested Waiting on additional info and feedback. Will move to close soon in 7 days. label Apr 12, 2021
@github-actions
Copy link
Contributor

This issue has not recieved a response in 2 weeks. If you want to keep this issue open, please just leave a comment below and auto-close will be canceled.

@github-actions github-actions bot added the closing-soon This issue will automatically close in 4 days unless further comments are made. label Apr 13, 2021
@github-actions github-actions bot added closed-for-staleness and removed closing-soon This issue will automatically close in 4 days unless further comments are made. labels Apr 21, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue is a bug. closed-for-staleness module/aspnetcore-support response-requested Waiting on additional info and feedback. Will move to close soon in 7 days.
Projects
None yet
Development

No branches or pull requests

4 participants