serverless-layers icon indicating copy to clipboard operation
serverless-layers copied to clipboard

Incompatible with dynamic deployment buckets

Open tstackhouse opened this issue 3 years ago • 7 comments

If no deployment bucket is configured, sls deploy will create a bucket dynamically, but this plugin does not pick up that bucket name and instead fails the entire deploy. This plugin would be very useful to package node_modules as a dedicated layer and slim down individual function packages.

tstackhouse avatar Jun 02 '21 17:06 tstackhouse

I'd really love to see this feature. As is it right now, I can't use this plugin, as it would mean creating a S3 bucket beforehands, which is not the purpose of IaC.

Would it be a possibility to see this feature in the future ?

AxopenLyon avatar May 16 '22 14:05 AxopenLyon

Does anyone have a workaround for this

Rayyan98 avatar Jan 05 '23 16:01 Rayyan98

I've been using this with the Deployment Bucket plugin, so that I'm not dynamically creating the deployment bucket, but it's still managed with serverless. The only downside for this is after doing sls remove, I have to manually (or have a CI script) empty and remove the deployment buicket.

tstackhouse avatar Jan 05 '23 16:01 tstackhouse

I would appreciate if this plugin exposed some hooks for me to use, but ig i'll use the same plugin as well

Rayyan98 avatar Jan 05 '23 17:01 Rayyan98

It is not something I'm planning to support/fix very soon, honestly. It would need a big refactoring which I can't do currently. https://github.com/agutoli/serverless-layers/issues/116

agutoli avatar Jan 06 '23 00:01 agutoli

I would appreciate if this plugin exposed some hooks for me to use, but ig i'll use the same plugin as well

What kind of hooks do you need?

agutoli avatar Jan 06 '23 00:01 agutoli

If the serverless-layers package can implement a lifecycle named deployLayer then serverless will auto generate a hook for me called before:deployLayer, then I can write a short plugin as a small js file which integrates in my serverless file, reads the layersDeploymentBucket name from custom and creates the bucket / ensures the bucket is created, before the serverless-layers plugin takes over. I would prefer this over integrating the plugin @tstackhouse mentioned because

  1. It is explicit control over execution flow,
  2. The small js file is very explicit about what it does and any developer that comes after me will be able to figure out why its necessary and they can safely remove it when serverless-layers plugin itself implements #116

I also created an issue for this here #132

Rayyan98 avatar Jan 06 '23 13:01 Rayyan98