Debugging locally in VS Code on Windows 11

0

I have been working through deploying lambda functions using the SAM CLI. Everything works on my end for local testing.

"sam local invoke -e src/events/event.json"

Works fine. I use "sam build" as part of my testing when I update my app.py file.

When I try to run the debugger with breakpoints, things break. The specific error is:

Error: PythonPipBuilder:ResolveDependencies - {docx2txt==0.8(sdist)}

Here is my setup: Python version 3.10.2 pip version 23.2.1

I have already run pip install docx2txt==0.8, and validated (in my environment) using pip list that I am on v=0.8.

Here is my requirements.txt: requests==2.26.0 urllib3==1.26.7 openai==0.28.1 pypdf docx2txt==0.8

interpreter being used is: Python 3.10.2 ('btivy' it my venv)

(btivy) (Sat 10/07/2023 11:13:23.77)C$python --version Python 3.10.2

I added the following environment variable to ensure that the SAM CLI was using the same pyton env.

(btivy) (Sat 10/07/2023 11:15:29.01)C$setx AWS_SAM_CLI_INTERPRETER "C:\Users\watso\dev\bigtechivy-backend\btivy\Scripts\python.exe"

SUCCESS: Specified value was saved.

But when I try to run via the debugger:

DEBUG app.py (from the Output tab in VS Code) 2023-10-07 11:07:28 [INFO]: log level: info 2023-10-07 11:07:28 [INFO]: endpoints: retrieving AWS endpoints data 2023-10-07 11:07:28 [INFO]: OS: Windows_NT x64 10.0.22621 2023-10-07 11:07:28 [INFO]: Visual Studio Code extension host: 1.82.3 2023-10-07 11:07:28 [INFO]: AWS Toolkit: 1.93.0 2023-10-07 11:07:28 [INFO]: node: 18.15.0 2023-10-07 11:07:28 [INFO]: electron: 25.8.1 2023-10-07 11:07:28 [WARN]: AwsContext: no default region in credentials profile, falling back to us-east-1: 2023-10-07 11:12:28 [INFO]: telemetry: sent batch (size=14) 2023-10-07 11:15:56 [INFO]: SAM CLI location (version: 1.98.0): C:\Program Files\Amazon\AWSSAMCLI\bin\sam.cmd 2023-10-07 11:15:59 [INFO]: Preparing to debug locally: Lambda "app.lambda_handler" 2023-10-07 11:15:59 [INFO]: Building SAM application... 2023-10-07 11:16:00 [INFO]: SAM CLI not configured, using SAM found at: 'C:\Program Files\Amazon\AWSSAMCLI\bin\sam.cmd' 2023-10-07 11:16:00 [INFO]: Command: (not started) [C:\Program Files\Amazon\AWSSAMCLI\bin\sam.cmd build --build-dir C:\Users\watso\AppData\Local\Temp\aws-toolkit-vscode\vsctkTEw1Or\output --template C:/Users/watso/dev/bigtechivy-backend/lambdas/isJobDescriptionBigTechIvy/template.yaml --manifest C:\Users\watso\AppData\Local\Temp\aws-toolkit-vscode\vsctkTEw1Or\debug-requirements.txt] 2023-10-07 11:16:33 [ERROR]: SAM CLI failed (exitcode: 1, expected 0): stdout: Build Failed stderr: Starting Build use cache Manifest file is changed (new hash: 5be9fccf6db188a261ebc7b73a213ada) or dependency folder (.aws-sam\deps\8909f503-5396-4719-9c8f-384955310688) is missing for (isJobDescriptionBigTechIvy), downloading dependencies and copying/building source Building codeuri: C:\Users\watso\dev\bigtechivy-backend\lambdas\isJobDescriptionBigTechIvy\src runtime: python3.10 metadata: {} architecture: x86_64 functions: isJobDescriptionBigTechIvy Running PythonPipBuilder:CleanUp Running PythonPipBuilder:ResolveDependencies Error: PythonPipBuilder:ResolveDependencies - {docx2txt==0.8(sdist)}

2023-10-07 11:16:33 [ERROR]: SamLaunchRequestError: SAM build failed: PythonPipBuilder:ResolveDependencies - {docx2txt==0.8(sdist)} [BuildFailure]

Things I have tried

  • Deleting the .aws-sam folder and doing a complete rebuild - DID NOT SOLVE
  • Creating an entirely new venv and starting over - DID NOT SOLVE
  • Using a different version of the docx2txt library (v=0.7) - DID NOT SOLVE

At this point I am at a loss for what I can do to all me to step through my code in the debugger.

Like I said, I can run and test locally using "sam local invoke", but it does not work with breakpoints.

Keine Antworten

Du bist nicht angemeldet. Anmelden um eine Antwort zu veröffentlichen.

Eine gute Antwort beantwortet die Frage klar, gibt konstruktives Feedback und fördert die berufliche Weiterentwicklung des Fragenstellers.

Richtlinien für die Beantwortung von Fragen