Open sjoerdhooft opened 4 years ago
What version of sam cli are you using?
sam --version
AWS: Deploy SAM Application
is a wrapper around the sam deploy
CLI command. Can you try running sam deploy
directly in your terminal and see what that yields?
The particular sam deploy ...
command that the Toolkit tried, should be in the logs somewhere. If you can't find it in the logs, you can cd
to your project directory where the template.yaml
lives and try this command (replace "mystack" and "us-east-1" as appropriate):
sam deploy --template-file template.yaml --stack-name mystack --capabilities CAPABILITY_IAM CAPABILITY_NAMED_IAM --region us-east-1
Found a hint here: https://github.com/aws/aws-toolkit-jetbrains/issues/1230#issuecomment-578699315
sam build
currently expects theCodeUri
property to point to the root of the Maven project, not the build artifact (jar file).
Hi Justin,
sam version:
SAM CLI, version 1.2.0
I tried the sam deploy command manually and it was successful, so that fixes my problem for now, but I still would like to use the vscode toolkit.
By the way, I used a simplified version of my template for this:
Resources:
CheckDomainAvailableFunction:
Type: AWS::Serverless::Function
Properties:
CodeUri: C:\AzureRepos\reponame\WebAppPS\checkdomainavailable.zip
Handler: checkdomainavailable::checkdomainavailable.Bootstrap::ExecuteFunction
Runtime: dotnetcore2.1
I will test later with a full version, but it seems to be in whatever is wrapping it.
BTW, I did see the jetbrains link so I already tried moving the file to different location. Maybe to clarify, what directory would sam build consider the root of the project? I assumed it was the directory with the template.yaml file. Is that correct.
I tried the sam deploy command manually and it was successful,
Can you share the exact command? Was it pointing to a template.yaml with CodeUri
pointing to a .zip
?
what directory would sam build consider the root of the project?
Looks like C:\AzureRepos\reponame\WebAppPS
would be the project root in this case.
So this would be your template.yaml (can you try this?):
Resources:
CheckDomainAvailableFunction:
Type: AWS::Serverless::Function
Properties:
CodeUri: C:\AzureRepos\reponame\WebAppPS
Handler: checkdomainavailable::checkdomainavailable.Bootstrap::ExecuteFunction
Runtime: dotnetcore2.1
If that doesn't work, try C:\AzureRepos\reponame
as the project root.
Hi, sorry it took a while, but I tried a full test. If I use sam deploy from commandline everything works as expected, under all circumstances.
Full command:
sam deploy --template-file template.yaml --stack-name sam-pstestfull --capabilities CAPABILITY_IAM CAPABILITY_NAMED_IAM --region eu-west-1 --s3-bucket s3bucketname --profile profilename
This is the relevant template.yaml:
CheckDomainAvailableFunction:
Type: AWS::Serverless::Function
Properties:
CodeUri: lambda/check-domain-available/checkdomainavailable.zip
Handler: checkdomainavailable::checkdomainavailable.Bootstrap::ExecuteFunction
Runtime: dotnetcore2.1
Role: !GetAtt OnBoardingR53LambdaRole.Arn
Events:
APIEvent:
Type: Api
Properties:
Path: /checkdomainavailable
Method: post
RestApiId: !Ref OnBoardingAPI
I already tried C:\AzureRepos\reponame\WebAppPS
and C:\AzureRepos\reponame
and both fail using vscode AWS Toolkit.
Describe the bug
CodeUri in Function has invalid directory name
To Reproduce
Deployment will fail with the following output:
An error occurred while deploying a SAM Application. Check the logs for more information by running the "View AWS Toolkit Logs" command from the Command Palette. Starting SAM Application deployment... Building SAM Application... Error with child process: Building function 'StartPaymentFunction' ,Running NodejsNpmBuilder:NpmPack ,Running NodejsNpmBuilder:CopyNpmrc ,Running NodejsNpmBuilder:CopySource ,Running NodejsNpmBuilder:NpmInstall ,Running NodejsNpmBuilder:CleanUpNpmrc ,Building function 'CheckDomainAvailableFunction' ,Running DotnetCliPackageBuilder:GlobalToolInstall , ,Tool 'amazon.lambda.tools' was reinstalled with the latest stable version (version '4.1.0'). ,Running DotnetCliPackageBuilder:RunPackageAction ,Error: DotnetCliPackageBuilder:RunPackageAction - [WinError 267] The directory name is invalid
Expected behavior
The function should be deployed to Lambda
Desktop (please complete the following information):
Additional context
In the template an additional nodejs function, as well as API and IAM roles are also deployed. This worked fine before I added the dotnetcore function.
Testing performed
I already tried moving the generated zip file to other directories anad different runtime dotnetcore2.1