Error: DotnetCliPackageBuilder:RunPackageAction - [WinError 267] The directory name is invalid
See original GitHub issueDescribe the bug
CodeUri in Function has invalid directory name
To Reproduce
- Create a powershell package using the new-awsPowerShellLambdaPackage:
New-AWSPowerShellLambdaPackage -ScriptPath checkdomainavailable.ps1 -OutputPackage checkdomainavailable.zip
- Add the function in template.yaml
CheckDomainAvailableFunction: Type: AWS::Serverless::Function Properties: CodeUri: lambda/check-domain-available/checkdomainavailable.zip Handler: checkdomainavailable::checkdomainavailable.Bootstrap::ExecuteFunction Runtime: dotnetcore3.1 Role: !GetAtt OnBoardingR53LambdaRole.Arn Events: APIEvent: Type: Api Properties: Path: /checkdomainavailable Method: post RestApiId: !Ref OnBoardingAPI
- Use the AWS: Deploy SAM Application
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):
- OS: Windows_NT x64 10.0.18362
- Visual Studio Code Version: 1.49.2
- AWS Toolkit Version: 1.14.0
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
Issue Analytics
- State:
- Created 3 years ago
- Comments:6 (4 by maintainers)

Top Related StackOverflow Question
Status
sam buildissue.sam deploywithoutsam buildworks.sam buildwhen deploying aCodeUri: ...zipHi, 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 profilenameThis is the relevant template.yaml:
I already tried
C:\AzureRepos\reponame\WebAppPSandC:\AzureRepos\reponameand both fail using vscode AWS Toolkit.