question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Error: DotnetCliPackageBuilder:RunPackageAction - [WinError 267] The directory name is invalid

See original GitHub issue

Describe 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:open
  • Created 3 years ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
justinmk3commented, Oct 15, 2020

Status

  • This is a sam build issue.
    • sam deploy without sam build works.
  • Toolkit could avoid this problem by skipping sam build when deploying a CodeUri: ...zip
0reactions
sjoerdhooftcommented, Oct 6, 2020

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

how to fix this error : [WinError 267] The directory name is invalid
The parameter you pass to os.chdir() function is invalid because it's not a directory it's a file path. You need to exclude file...
Read more >
Getting Error: NotADirectoryError: [WinError 267] The directory ...
am getting the following error. Getting Error: NotADirectoryError: [WinError 267] The directory name is invalid. File and folder both are valid
Read more >
NotADirectoryError : [WinError 267] The directory name is invalid
I tried to access google with selenium python on Firefox and this error occurred The code is the following: from time import sleep...
Read more >
[WinError 267] The directory name is invalid: data\\BTS\\valid ...
My complete code is as below: `import sys sys.path.append(“C:\Users\Anurag\github_pro\fastai”) from fastai.imports import * from ...
Read more >
install_github(): "system error 267, The directory name is invalid"
I am trying to install package performance development version with devtools but am getting this error: ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found