Skip to content
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

Support Lambda images #139

Closed
matthewhanson opened this issue May 25, 2022 · 2 comments · Fixed by #150
Closed

Support Lambda images #139

matthewhanson opened this issue May 25, 2022 · 2 comments · Fixed by #150
Milestone

Comments

@matthewhanson
Copy link
Member

  • Update serverless to at least 2.72
  • update path in API proxy
  • remove magic addition of module and handler during build (put in template)
@matthewhanson matthewhanson added this to the 0.7.0 milestone May 25, 2022
@jkeifer
Copy link
Collaborator

jkeifer commented May 27, 2022

So if we want to support serverless >=3.0, we have to remove the serverlerss-pseudo-parameters plugin. The replacement on the serverless side only supports two common parameters, region and account id. For every other use, we have to convert to using Fn:Sub.

Interestingly, we can easily process strings using the same regex as the aforementioned plugin, looking for things within a string that match the pattern #{AWS::[^}]+} and replacing the # with a $. If not already inside a Fn:Sub then we can add that.

Now, the concern becomes the fact that serverless also uses ${...} for its variable interpolation, but good news: as of 2.3.0, the parser is smart enough to leave the AWS parameters alone (see https://github.com/serverless/serverless/releases/tag/v2.3.0 and serverless/serverless#8279).

In other words, we can implement our own mini version of the pseudo parameters plugin. We could also consider logging a deprecation warning with details how to get off the #{...} syntax. But for now we'll just make things work without the plugin and see how that goes.

@jkeifer jkeifer mentioned this issue Aug 24, 2022
@jkeifer jkeifer linked a pull request Sep 8, 2022 that will close this issue
@jkeifer
Copy link
Collaborator

jkeifer commented Sep 12, 2022

The removal of the module/handler magic will now result in a MissingHandler exception if the module is not defined explicitly in a lambda task definition.yml. The error looks something like this:

MissingHandler: Missing module parameter in lambda definiton.yml. The handler parameter, which sets the module, is no longer defaulted. You likely need to set it to be like:

    lambda:
      handler: lambda_function.lambda_handler

Offending <lambda_type>: <lambda_name>

See https://github.com/cirrus-geo/cirrus-geo/issues/139 for additional context.

This is as it says, a problem with the handler not being defined for a lambda. The module is inferred from the handler, and is used for lambda packaging. If the handler is missing, then it needs to be added to the definition.yml.

In the case of lambdas using the new container image support, then the above is incorrect, and the problem is that the image parameter is missing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants