-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
Code.fromAsset("...") is not updating lambda-functions #7669
Comments
Hi! Can you provide the full code? const fn = new lambda.Function(this, 'MyLambda', {
code: lambda.Code.fromAsset(path.join(__dirname, './lambda')),
handler: 'index.handler',
runtime: Runtime.NODEJS_12_X
}); Do you see the same parameters name produced when you change the content of the dist folder? |
Looks like #7718 |
@NetaNir @jogold Thank you for your input. Here is my code: const myFunction = new lambda.Function(this, "myFunction", {
code: lambda.Code.fromAsset("dist", { exclude: ["**", "!my-function.js"] }),
handler: "my-function.entrypoint",
runtime: lambda.Runtime.NODEJS_12_X,
}); The reason why I use an exclude pattern here is, that I am outputting multiple lambda-functions to |
@Syy0n - sorry for the late reply, but can you also provide your directory structure? Specifically the output of |
@nija-at The output is:
|
I just tried your example and it worked fine for me. The CDK app I used - import { Function, Code, Runtime } from '@aws-cdk/aws-lambda';
import { App, Stack } from '@aws-cdk/core';
const app = new App();
const stack = new Stack(app, 'mystack-lambda');
new Function(stack, 'myfn', {
runtime: Runtime.NODEJS_12_X,
handler: 'index.handler',
code: Code.fromAsset('resources', {
exclude: [ '**', '!a.js']
})
}) The
and the asset folder looks like this -
I believe this matches what was intended with the |
I think that this was #7718 that has been fixed in v1.38.0. |
Nice. Thanks @jogold. Resolving this issue. Feel free to re-open with more details if it persists. |
Description
When I create a lambda-function within a cdk-stack based on
Code.fromAsset("dist", { exclude: ["**", "!lambda-already-bundled-with-webpack.js"] })
, then the lambda-function, when deployed for the first time, works fine. But when a code-update to the lambda-function is made, a re-deploy of the same cdk-stack is not updating the code of the deployed lambda-function. The lambda-function still has the old code from the first deployment. Acdk diff
also says that no changes were detected...Reproduction Steps
Error Log
Environment
Other
This is 🐛 Bug Report
The text was updated successfully, but these errors were encountered: