Comments (8)
@markusgulden sam local
does not work if you point the template CodeUri
the pom.xml
It seems only AWS Toolkit would work like this, which is confusing because then you have to change your template based on whether you invoke Sam from your IDE or from the cli (or have 2 different templates).
from aws-lambda-builders.
Okay so the @jaxley fix worked. Although using the base as the override in the test, (as opposed to using the target executable as the override in the buildspec), is then causing the 'Deploy serverless application' feature (when right clicking template.yml) to fail.
So to clear things up, the default CodeUri needs to be the source root with the pom, then this needs to be overridden for a deployment. This is assumed. I have still not got round to fixing this but will follow up.
from aws-lambda-builders.
Figured an explicit workaround example would be useful.
Facing the same issue,
if I give a path to pom.xml then Sam local does not work,
and if I give the path to jar then sam build does not work. Any good way to do this?You can use a Parameter in the template.yml file and specify the correct value for a
sam build
using--parameter-overrides
. See the docs for this: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/parameters-section-structure.html
Snippet from template.yaml:
Parameters:
CodeUri:
Description: CodeUri - change this to pom.xml directory for AWS Toolkit IDE plugin with --parameter-overrides "CodeUri"
Type: String
Default: lambda/target/foo.jar
Resources:
LambdaFunction:
Type: AWS::Serverless::Function
Properties:
CodeUri: !Sub ${CodeUri}
....
Invoking with sam (from project directory containing pom.xml; otherwise, choose a different directory relative to the template.yaml file location):
sam build --debug --parameter-overrides "ParameterKey=CodeUri,ParameterValue=."
from aws-lambda-builders.
You need to point the CodeUri attribute in your template.yaml to the directory with your pom.xml, not to */target/lambda.jar.
That solved the issue for me, at least.
from aws-lambda-builders.
Facing the same issue,
if I give a path to pom.xml then Sam local does not work,
and if I give the path to jar then sam build does not work. Any good way to do this?
You can use a Parameter in the template.yml file and specify the correct value for a sam build
using --parameter-overrides
. See the docs for this: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/parameters-section-structure.html
from aws-lambda-builders.
same issue here, the only way I made it work is to have my handler implement RequestHandler
from aws-lambda-builders.
Facing the same issue,
if I give a path to pom.xml then Sam local does not work,
and if I give the path to jar then sam build does not work. Any good way to do this?
from aws-lambda-builders.
I too am having this issue. Will attempt the fix mentioned. Java8 + IntelliJ + AWS Toolkit Plugin, trying to test Lambda's locally using docker containers.
from aws-lambda-builders.
Related Issues (20)
- SAM build failed in sam cli using python 3.9. HOT 3
- How to make `sam` hold my SSH keys so `sam build` can download dependencies from my private repository? HOT 4
- [Announcement] Deprecating AWS Lambda Builders on python3.6 HOT 1
- Feature request: Add support for ES Modules with esbuild. HOT 4
- Feature request: Support packaging resource files with workflow HOT 7
- Add support for SourcesContent option in esbuild builds HOT 2
- Bug: UnsupportedPackageError when tests run under setuptools 66+ HOT 1
- [Announcement] .NET Core 3.1 Runtime Deprecation
- Using pip 23.1 produces invalid deployment file when package references other local packages HOT 1
- Feature request: Allow ignoring dependencies when building with python pip HOT 2
- Bug: sam build throws error with python packages installed with git+https url HOT 3
- Bug: No message from the Maven's stderr in the sam output logs HOT 1
- Feature request: Include/Exclude Interface for AWS Lambda Builders HOT 3
- Bug: SAM is failing to build python package neo4j HOT 5
- German Umlaut in Maven stdout causes SAM build to fail HOT 4
- NodejsNpmEsbuildBuilder:NpmInstall - NPM Failed: npm WARN config production Use `--omit=dev` instead HOT 3
- Can not install custom python dependency from custom git url HOT 4
- Bug: Using AWS::Serverless::LayerVersion with BuildMethod: makefile and python runtime fails to build HOT 2
- [Announcement] Upcoming Runtime Deprecations
- Bug: dnf command does not work on version of public.ecr.aws/lambda/python:3.11-x86_64 publish around 2023.12.05 16:00 UTC HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from aws-lambda-builders.