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
Issue in adding provisionedConcurrency or functionVersion set to true, Could not find reference to layer created in Resource section #9797
Comments
Hello @naveenbalaneni - thanks for reporting, I have one extra question. When you don't use listed settings, does the layer get properly attached to your function? |
@pgrzesik, thank you looking into the issue. If I setup version versionFunctions: false and comment provisionedConcurrency. same code is working fine. If I enable one of versionFunctions or provisionedConcurrency, serverless unable to find the layer |
Thanks a lot for providing that information, I believe I know what is the cause here and it is calculating hashes when provisionedConcurrency or function versioning is concerned. At the moment, referencing layers via We also have a ticket that would improve the way locally defined layers are referenced here: #8915 |
@pgrzesik Thank you for info. I have downgraded Serverless Version to 1.83.3. This version I am able to enable both Provisioned Concurrency and the layerVersion. I will wait until this issue gets addressed to update serverless version to latest. |
@pgrzesik do you know why it works in v1 and not in v2? |
I was investigating it and I've noticed that it was due to the fact that in In such situations, I believe we should just ignore layers that cannot be found, but by implementing such behavior, we introduce a risk that invalid references to locally defined layers will be passed silently, without any errors, which I believe is something that we should not allow (it is still a potential problem if I'm not mistaken but to lesser extent). What do you think @medikoo ? |
@pgrzesik
so that we can clone the package from S3, instead from local. Thank you, |
@pgrzesik great thanks for feedback. One thing I miss, is why given configuration works for @naveenbalaneni while it's considered as invalid on our side? If it works, shouldn't it be considered valid ? |
It is considered invalid on our side due to a tradeoff. At the moment, the only way to reference local layers is to use So, the tradeoff that I mention here is this, we can either:
Currently, our logic supports the option number 2. One way would be to switch to option 1, which would unblock this specific case or implement a solution mentioned in #8915 which would allow for a less error-prone way to reference local layers, which in turn makes it safer to have option 1 for tradeoff above. What is your opinion here? Maybe we should go with option 1 here to support all cases, while offering a little bit worse experience in case of typos when referencing local layers? Note: While this layer is also local in the sense that it is a part of the same CloudFormation template, it hasn't been defined with |
@pgrzesik I assume a valid fix might be ignore the fact of missing layer, but only if we find the resources of given id in result template (and we may also then additionally validate its type). Still I guess it's tricky to implement, as at given point we do not have yet access to fully resolved template. |
Yes, I was thinking about that option as well, but I identified the same "issue" with the fact that we're adding |
I assume that validation was added in context of improving hash generation, and back then we didn't specifally address a complaint that validation is missing. We probably should remove that warning, as (1) if user is referencing by |
I believe that's a fine tradeoff, I've just prepared a PR: #9826 |
Unable to find the reference to layer in resource section, especially when we enable the provisionedConcurrency or functionVersion set to true.
if we remove both provisionedConcurrency or functionVersion in serverless script, same code is working fine without any issues
Could not find reference to layer: rtnLayer. Ensure that you are referencing layer defined in your service.
serverless.yml
serverless package -c serverless.yml --stage=devint
outputServerless: Running "serverless" installed locally (in service node_modules)
Framework Core: 2.52.1 (local)
Plugin: 5.4.3
SDK: 4.2.6
Components: 3.14.2
The text was updated successfully, but these errors were encountered: