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 serverless compose #20

Open
vicary opened this issue Dec 2, 2023 · 3 comments
Open

Support serverless compose #20

vicary opened this issue Dec 2, 2023 · 3 comments

Comments

@vicary
Copy link

vicary commented Dec 2, 2023

We have monorepo using Serverless Compose in one of the yarn workspaces.

Our directory structure looks like this:

workspaces/
├─ backend/
│  ├─ stacks/
│  │  ├─ functions-a/
│  │  │  ├─ serverless.yml
│  ├─ serverless-compose.yml
├─ frontend/

Serverless compose allows running stack specific commands like this,

> serverless functions-a:package

After adding serverless-analyze-bundle-plugin in my serverless.yml, it is still not recognizing the CLI option --analyze.

> yarn workspace backend serverless functions-a:package --analyze

Error:
Unrecognized CLI options: "--analyze"

These are the related package versions in use:

  1. serverless: 3.38
  2. serverless-esbuild: 1.49
  3. serverless-analyze-bundle-plugin: 2.01
@adriencaccia
Copy link
Owner

Hey, thanks for the thorough issue

This is the way I configured the plugin to add the analyze option to the package command:

package: {
usage: 'Analyze the bundle of a lambda function',
options: {
analyze: {
// @ts-expect-error plugin is badly typed 🤔
type: 'string',
usage: 'Specify the function you want to analyze (e.g. "--analyze \'helloWorld\'")',
},

It's a bit of a hack but it worked since the command object is merged in the default one from serverless.

@medikoo do you know if it is possible to have something similar work with serverless compose?

@medikoo
Copy link

medikoo commented Dec 5, 2023

@medikoo do you know if it is possible to have something similar work with serverless compose?

@adriencaccia I'm not sure, but I suspect it can be difficult, as compose technically is a hack that runs all deploys as individual serverless commands in separate processes. Through that there's a lot limitations

@vicary
Copy link
Author

vicary commented Dec 7, 2023

I think I got ya.

Moving from the serverless-split-stack-plugin to compose is our last resort as a workaround to the many limitations of CloudFormation. It works for now, but we see where it stops.

Does Serverless offers a solution for stacks this size (~800 AppSync resolvers, 300 lambdas) and up?

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

No branches or pull requests

3 participants