-
Notifications
You must be signed in to change notification settings - Fork 16
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
Cannot find asset with NodejsFunction created asset #258
Comments
I have put up an example application here, https://github.com/mbergkvist/stacksetsandassets The command I execute is npm run cdk list and the error is Error: Cannot find asset at /Users/markus/tmp/stacksetsandassets/cdk.out/Users/markus/tmp/stacksetsandassets |
Some updates:
The example in https://github.com/mbergkvist/stacksetsandassets is updated to include PythonFunction. |
thanks for reporting this. i tested a nodejs function with the recent updates in #325 and it seems to work OK. there is an issue with python lambda with the s3 asset file name that gets produced that we will look into. |
I'll take #325 for a spin on my example repo, testing it with both nodejs function and Rust function. |
@josh-demuth Tested #325 with the project in mbergkvist/stacksetsandassets#1 but I still get the same error. It looks like it's adding the asset directory as source to the bucketDeployment instead of the asset filename. |
yes was testing more and sometimes it would work and sometimes not. the s3 bucket deployment process is getting a different hash. the lambda asset process creates a directory and not a zip at this stage of the process. are you seeing a .zip file be created in your cdk.out? |
There is a zip-file asset.3322b7049fb0ed2b7cbb644a2ada8d1116ff80c32dca89e6ada846b5de26f961.zip. The content of the file is the |
Updated to cdk-stackset-0.0.150 (release of #325) in mbergkvist/stacksetsandassets#1. Unfortunately getting the same error. |
Hello team, I am experimenting the same issue when running
|
I found this thread with high hopes until I clicked and saw it was still open. I am too experienceing this issue.
|
This is an issue that I am seeing, if I create the lambda function using the bundler the deployment is unable to find the file in the s3 bucket.
If I manually package the file and add the zip file as an asset, everything works fine. |
I hit the same issue and discovered that if the bundling options are omitted, then the asset archive filename (the SHA256 one) will be identical to the one in the staging bucket. This is a workaround for the problem, if you can omit the bundling options or bundle the function code externally. Example: # This produces error because the asset hash is different from the staging asset hash:
on_event_handler_function = lambda_.Function(
self,
id="OnEventFunction",
function_name=on_event_handler_function_name,
runtime=lambda_.Runtime.PYTHON_3_13,
role=on_event_handler_role,
code=lambda_.Code.from_asset(
os.path.join(os.path.dirname(__file__), "lambda", "dependency_signal"),
bundling=BundlingOptions(
image=lambda_.Runtime.PYTHON_3_13.bundling_image,
command=[
"bash",
"-c",
"pip install --no-cache-dir -r requirements.txt -t /asset-output && cp -au . /asset-output",
],
),
),
timeout=Duration.minutes(5),
log_retention=logs.RetentionDays.ONE_WEEK,
handler="index.on_event",
)
# This DOES NOT produce error because the asset hash is identical to the staging asset hash:
on_event_handler_function = lambda_.Function(
self,
id="OnEventFunction",
function_name=on_event_handler_function_name,
runtime=lambda_.Runtime.PYTHON_3_13,
role=on_event_handler_role,
code=lambda_.Code.from_asset(os.path.join(os.path.dirname(__file__), "lambda", "dependency_signal")),
timeout=Duration.minutes(5),
log_retention=logs.RetentionDays.ONE_WEEK,
handler="index.on_event",
) Apologies if I am not using the correct terminology, I am fairly new to this. |
I trying to deploy a
NodejsFunction
with a stackset but I can't get the file asset to work. I get the following errorIt looks like it's adding the asset directory as source to the
bucketDeployment
instead of the asset filename. Can't figure out why though.How to reproduce
A simplified example of what I'm trying to accomplish, more or less following the example in the project README.
Any advice?
The text was updated successfully, but these errors were encountered: