等待命令"sam local invoke"超时。

6

我正在使用AWS SAM构建无服务器应用程序

SAM + VSCode + Docker desktop

一切都很顺利,但突然之间,当我运行调试时出现超时错误。

请注意:sam local invoke(不带调试)正常工作。

问题出现在我运行调试模式(即F5)时停止运行,如下所示。这可能是网络问题吗?Python版本?以前调试可以正常工作。

还要注意:我有一个Windows 10主机,我在其中运行一个Windows 10虚拟机(HyperV),并在其中设置了这个开发环境。

以下是日志:

    2021-05-20 11:43:48 [INFO]: Preparing to debug locally: Lambda "qa.lambdaHandler"
    2021-05-20 11:43:48 [INFO]: Building SAM application...
    2021-05-20 11:43:48 [INFO]: Running command: (not started) [C:\Program Files\Amazon\AWSSAMCLI\bin\sam.cmd build --build-dir C:\Users\PK\AppData\Local\Temp\aws-toolkit-vscode\vsctkzhq0Ca\output
--template C:/Users/PK/code/GCMS-AWS/publish-dynamodb/cmsqa/app___vsctk___template.yaml
--base-dir C:/Users/PK/code/GCMS-AWS/publish-dynamodb/cmsqa]
    2021-05-20 11:43:50 [INFO]: Building codeuri: C:/Users/PK/code/GCMS-AWS/publish-dynamodb/cmsqa runtime: nodejs12.x metadata: {} functions: ['cmsqa']
    
    2021-05-20 11:43:50 [INFO]: Running NodejsNpmBuilder:NpmPack
    
    2021-05-20 11:44:02 [INFO]: Running NodejsNpmBuilder:CopyNpmrc
    
    2021-05-20 11:44:02 [INFO]: Running NodejsNpmBuilder:CopySource
    
    2021-05-20 11:44:02 [INFO]: Running NodejsNpmBuilder:NpmInstall
    
    2021-05-20 11:44:28 [INFO]: Running NodejsNpmBuilder:CleanUpNpmrc
    
    2021-05-20 11:44:30 [INFO]: 
    Build Succeeded
    
    2021-05-20 11:44:30 [INFO]: 
    Built Artifacts  : ..\..\Temp\aws-toolkit-vscode\vsctkzhq0Ca\output
    Built Template   : ..\..\Temp\aws-toolkit-vscode\vsctkzhq0Ca\output\template.yaml
    
    Commands you can use next
    =========================
    [*] Invoke Function: sam local invoke -t ..\..\Temp\aws-toolkit-vscode\vsctkzhq0Ca\output\template.yaml
    [*] Deploy: sam deploy --guided --template-file ..\..\Temp\aws-toolkit-vscode\vsctkzhq0Ca\output\template.yaml
        
    
    2021-05-20 11:44:30 [INFO]: Build complete.
    2021-05-20 11:44:30 [INFO]: Starting SAM application locally
    2021-05-20 11:44:30 [INFO]: AWS.running.command
    2021-05-20 11:44:30 [ERROR]: Timeout while waiting for command: "sam local invoke"
    2021-05-20 11:44:30 [ERROR]: Failed to run SAM application locally: Timeout while waiting for command: "sam local invoke"
    
    Command stopped: "sam local invoke"
1个回答

7

我花了很多时间找到了这个问题…… 需要在这里增加超时时间…… 截图


1
可以确认我遇到了同样的问题,而且这确实是解决方案。可能是另一个插件或者 Visual Studio Code 中的一个 bug 未经提示地更新了这个设置。值得一提的是,超时时间被设置为 "1234"(以毫秒为单位),导致了超时问题的发生。在找到这个解决方案之前,我也花了很多时间。 - undefined

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接