Open francis-pang opened 4 years ago
Hello. Is it resolved?
Hi @alissonxavierosfglobal , as far as I understand, there is no work done on this yet.
The problem is that the CodeUri referring the parent pom folder is also used as working directory in sam build. It would be useful to configure in the AWS Toolkit SAM options the base-dir options like in the CLI.
Here is my workaround in vscode:
In the template.yaml, set the CodeUri parameter to the local folder
CodeUri: .
Then, place the template.yaml close to the parent pom.xml (so that the parent and modules will be copied) and run the following command by replacing the module folder with one of the available one (the working directory to the aws lambda maven module so that sam could bind target classes and dependencies).
sam build -s ./module\ -t ./template.yaml
Prepare a event.json which contains the payload (body) of your lambda
run the sam package
sam local invoke -d 5870 -e ./event.json
In vscode, add a debug configuration (Java attach to process) and setup like this :
{
"type": "java",
"name": "Attach to Remote Program",
"request": "attach",
"hostName": "localhost",
"port": "5870"
}
Go to debug and the the "Attach to Remote Program", now you can break anywhere in the java lambda code
Description:
Steps to reproduce
sam build --use-container --template-file template.yaml
Observed result:
Expected result: Build is successful after
Additional environment details (Ex: Windows, Mac, Amazon Linux etc) Project directory is as below: only showing the relevant one, full project directory is at aws-sam branch
Contents of template.yaml: