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

Bug: [WinError 3] The system cannot find the path specified #7053

Closed
dan933 opened this issue May 12, 2024 · 4 comments
Closed

Bug: [WinError 3] The system cannot find the path specified #7053

dan933 opened this issue May 12, 2024 · 4 comments
Labels
area/build sam build command blocked/more-info-needed More info is needed from the requester. If no response in 14 days, it will become stale. platform/windows

Comments

@dan933
Copy link

dan933 commented May 12, 2024

Description:

When using sam build I got the following error:

Error: [WinError 3] The system cannot find the path specified: '.aws-sam\build\TradesGateway\CreateSuperUser\node_modules\@AWS-SDK\credential-provider-node\node_modules\@AWS-SDK\client-sso-oidc\dist-es\auth\httpAuthExtensionConfiguration.js

full error ``` Error: [WinError 3] The system cannot find the path specified: '.aws-sam\\build\\TradesGateway\\CreateSuperUser\\node_modules\\@AWS-SDK\\credential-provider-node\\node_modules\\@AWS-SDK\\client-sso-oidc\\dist-es\\auth\\httpAuthExtensionConfiguration.js' Traceback: File "C:\Program Files\Amazon\AWSSAMCLI\runtime\Lib\site-packages\click\core.py", line 1078, in main rv = self.invoke(ctx) ^^^^^^^^^^^^^^^^ File "C:\Program Files\Amazon\AWSSAMCLI\runtime\Lib\site-packages\click\core.py", line 1688, in invoke return _process_result(sub_ctx.command.invoke(sub_ctx)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Program Files\Amazon\AWSSAMCLI\runtime\Lib\site-packages\click\core.py", line 1434, in invoke return ctx.invoke(self.callback, **ctx.params) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Program Files\Amazon\AWSSAMCLI\runtime\Lib\site-packages\click\core.py", line 783, in invoke return __callback(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Program Files\Amazon\AWSSAMCLI\runtime\Lib\site-packages\samcli\cli\cli_config_file.py", line 347, in wrapper return func(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^ File "C:\Program Files\Amazon\AWSSAMCLI\runtime\Lib\site-packages\click\decorators.py", line 92, in new_func return ctx.invoke(f, obj, *args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Program Files\Amazon\AWSSAMCLI\runtime\Lib\site-packages\click\core.py", line 783, in invoke return __callback(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Program Files\Amazon\AWSSAMCLI\runtime\Lib\site-packages\samcli\lib\telemetry\metric.py", line 185, in wrapped raise exception # pylint: disable=raising-bad-type ^^^^^^^^^^^^^^^ File "C:\Program Files\Amazon\AWSSAMCLI\runtime\Lib\site-packages\samcli\lib\telemetry\metric.py", line 150, in wrapped return_value = func(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^ File "C:\Program Files\Amazon\AWSSAMCLI\runtime\Lib\site-packages\samcli\lib\utils\version_checker.py", line 43, in wrapped actual_result = func(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^ File "C:\Program Files\Amazon\AWSSAMCLI\runtime\Lib\site-packages\samcli\cli\main.py", line 95, in wrapper return func(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^ File "C:\Program Files\Amazon\AWSSAMCLI\runtime\Lib\site-packages\samcli\commands\build\command.py", line 175, in cli do_cli( File "C:\Program Files\Amazon\AWSSAMCLI\runtime\Lib\site-packages\samcli\commands\build\command.py", line 240, in do_cli with BuildContext( File "C:\Program Files\Amazon\AWSSAMCLI\runtime\Lib\site-packages\samcli\commands\build\build_context.py", line 185, in __enter__ self.set_up() File "C:\Program Files\Amazon\AWSSAMCLI\runtime\Lib\site-packages\samcli\commands\build\build_context.py", line 216, in set_up self._build_dir = self._setup_build_dir(self._build_dir, self._clean) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Program Files\Amazon\AWSSAMCLI\runtime\Lib\site-packages\samcli\commands\build\build_context.py", line 467, in _setup_build_dir shutil.rmtree(build_dir) File "shutil.py", line 787, in rmtree File "shutil.py", line 629, in _rmtree_unsafe File "shutil.py", line 629, in _rmtree_unsafe File "shutil.py", line 629, in _rmtree_unsafe [Previous line repeated 7 more times] File "shutil.py", line 634, in _rmtree_unsafe File "shutil.py", line 632, in _rmtree_unsafe ```

I control click on the path and the file does exist.

I have run this code recently and the resources successfully built and deployed, I'm not too sure what has changed.

Steps to reproduce:

I have an sam template with nested AWS::Serverless::Applications

One is an API gateway that contains a lambda function

  TradesGateway:
    Type: AWS::Serverless::Application
    Properties:
      Parameters:
        CognitoUserPoolId: !GetAtt Cognito.Outputs.CognitoUserPoolId
        Stage: !Ref Stage
        DBUser: !Ref DBUser
        DBPassword: !Ref DBPassword
        DBName: !Ref DBName
        superUserToken: !Ref superUserToken
      Location: gateway-service/gateway.yaml
    DependsOn:
    - Cognito
    - TradesAppVpc
    - DB
  CreateSuperUser:
    Type: AWS::Serverless::Function
    Properties:
      CodeUri: src/auth-services/
      Handler: createSuperUser/createSuperUser.handler
      Runtime: nodejs20.x
      Architectures:
      - x86_64
      MemorySize: 128
      Timeout: 30
      Description: Create super user
      Events:
        ApiEvent:
          Type: Api
          Properties:
            Path: /super-user/create
            Method: POST
            RestApiId: !Ref TradesGateway
            Auth:
              Authorizer: SuperUserAuthorizer
      Policies:
        - AWSLambdaBasicExecutionRole
        - Version: '2012-10-17'
          Statement:
            - Effect: Allow
              Action:
                - cognito-idp:AdminCreateUser
                - cognito-idp:AdminAddUserToGroup
                - cognito-idp:AdminGetUser
                - cognito-idp:*
              Resource: !Sub 'arn:aws:cognito-idp:${AWS::Region}:${AWS::AccountId}:userpool/${CognitoUserPoolId}'

The CodeUri src/auth-services/
Has a package.json file that contains the following

{
  "name": "auth-services",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "author": "",
  "license": "ISC",
  "dependencies": {
    "@aws-sdk/client-cognito-identity-provider": "^3.556.0",
    "drizzle-orm": "^0.30.9",
    "postgres": "^3.4.4",
    "@middy/core": "^5.3.2",
    "@middy/http-error-handler": "^5.3.2",
    "@middy/http-header-normalizer": "^5.3.2",
    "@middy/http-json-body-parser": "^5.3.2",
    "http-errors": "^2.0.0"
  }
}

Additional environment details (Ex: Windows, Mac, Amazon Linux etc)

{
  "version": "1.116.0",
  "system": {
    "python": "3.11.8",
    "os": "Windows-10-10.0.22631-SP0"
  },
  "additional_dependencies": {
    "docker_engine": "Not available",
    "aws_cdk": "Not available",
    "terraform": "1.8.0-dev"
  },
  "available_beta_feature_env_vars": [
    "SAM_CLI_BETA_FEATURES",
    "SAM_CLI_BETA_BUILD_PERFORMANCE",
    "SAM_CLI_BETA_TERRAFORM_SUPPORT",
    "SAM_CLI_BETA_RUST_CARGO_LAMBDA"
  ]
}
  1. OS: Windows 11
  2. sam --version: 1.116.0
  3. AWS region: ap-southeast-2
Debug Flag Results
Sending Telemetry: {'metrics': [{'commandRun': {'requestId':
'35281d10-e415-4b78-8701-d3f2a997ee15', 'installationId': '10cf6eca-c014-4575-af67-d030eee179a3', 'sessionId':
'9ecf0710-f3d5-4d3f-816f-ae059ee8e0c4', 'executionEnvironment': 'CLI', 'ci': False, 'pyversion': '3.11.8',
'samcliVersion': '1.116.0', 'awsProfileProvided': False, 'debugFlagProvided': True, 'region': '', 'commandName': 'sam     
build', 'metricSpecificAttributes': {'projectType': 'CFN', 'gitOrigin':
'3f532e426edb4a28cae24acc7fd3710e390d888ae282fa55d24479415da6e11a', 'projectName':
'633a6425fe620c0a7ae67cca6534721acf155109b996592270dc69d82c263aaa', 'initialCommit':
'49949bef54acfa9045e6714d0b55e027630d2380871b23a6768be818381c2cc2'}, 'duration': 330, 'exitReason': 'FileNotFoundError',  
'exitCode': 255}}]}
2024-05-12 16:36:00,733 | Unable to find Click Context for getting session_id.
2024-05-12 16:36:00,736 | Sending Telemetry: {'metrics': [{'events': {'requestId': '88e7a8a7-dc9b-4fc3-a791-6725db3a089c',
'installationId': '10cf6eca-c014-4575-af67-d030eee179a3', 'sessionId': '9ecf0710-f3d5-4d3f-816f-ae059ee8e0c4',
'executionEnvironment': 'CLI', 'ci': False, 'pyversion': '3.11.8', 'samcliVersion': '1.116.0', 'commandName': 'sam build',
'metricSpecificAttributes': {'events': [{'event_name': 'SamConfigFileExtension', 'event_value': '.toml', 'thread_id':     
'9eb3f03f2bd841b083a66e6c2b6f315a', 'time_stamp': '2024-05-12 06:36:00.273', 'exception_name': None}, {'event_name':      
'SamConfigFileExtension', 'event_value': '.toml', 'thread_id': '8b5976734611478393c3c7b4a7264008', 'time_stamp':
'2024-05-12 06:36:00.289', 'exception_name': None}]}}}]}
2024-05-12 16:36:01,707 | HTTPSConnectionPool(host='aws-serverless-tools-telemetry.us-west-2.amazonaws.com', port=443):   
Read timed out. (read timeout=0.1)
2024-05-12 16:36:01,708 | HTTPSConnectionPool(host='aws-serverless-tools-telemetry.us-west-2.amazonaws.com', port=443):   
Read timed out. (read timeout=0.1)

I apologies if I have not correctly laid out this issue as this is the first issue I have submitted

@dan933 dan933 added the stage/needs-triage Automatically applied to new issues and PRs, indicating they haven't been looked at. label May 12, 2024
@mndeveci
Copy link
Contributor

Hi @dan933,

Thanks for reporting this issue. Can you re-run sam build by removing the .aws-sam folder? I wonder if that would help the fix for the issue.

Also, I saw that you are using Windows, did you enable long path configuration on your machine? It might create problems when path of the file gets longer.

@mndeveci mndeveci added platform/windows blocked/more-info-needed More info is needed from the requester. If no response in 14 days, it will become stale. area/build sam build command and removed stage/needs-triage Automatically applied to new issues and PRs, indicating they haven't been looked at. labels May 16, 2024
@dan933
Copy link
Author

dan933 commented May 18, 2024

Thank you @mndeveci,
I removed the .aws-sam build folder and this solved the issue I really appreciate the help.
I did not have long file paths enabled I have enabled it incase this causes problems in the future.

@mndeveci
Copy link
Contributor

Sounds good! Please let us know if you experience other issues in the future

Copy link
Contributor

⚠️COMMENT VISIBILITY WARNING⚠️

Comments on closed issues are hard for our team to see.
If you need more assistance, please either tag a team member or open a new issue that references this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/build sam build command blocked/more-info-needed More info is needed from the requester. If no response in 14 days, it will become stale. platform/windows
Projects
None yet
Development

No branches or pull requests

2 participants