components
components copied to clipboard
Template instances must use the same org, app & stage properties
Description
I have a multi stage setup, here is my current directory structure
➜ tree
.
├── README.md
├── dev
│ └── serverless.yml
├── package.json
└── prod
└── serverless.yml
When I run sls deploy --config=dev/serverless.yml
I get the following error:
➜ sls deploy --config=dev/serverless.yml
serverless ⚡framework
Serverless › Template instances must use the same org, app & stage properties
Documentation: https://github.com/serverless/components
Support: https://app.serverless.com/support
Slack: https://www.serverless.com/slack/
However if I remove the prod
directory, or if I specify --stage=dev
then the deploy command is successful
the prod and dev config seem to be interfering with each other in a weird way
Possibly related to https://github.com/serverless/components/issues/860
In both cases, using the flag --config=path-to-serverless.yml
leads to weird errors
Temporarily solved by not using --config
:
In package.json:
"scripts": {
"deploy:dev": "cd dev && sls deploy && cd -",
"deploy:prod": "cd prod && sls deploy && cd -"
}
I don't think there's a --config
flag for components. Remember that the original Serverless Framework and Serverless Components are completely different systems, and different CLIs, with different interfaces. Even though they are both loaded with the same installation & binary by automatically detecting the type of your projects, they work completely differently. So if something works on the framework side, it may not always work on Components.
For complete docs on the components CLI, please refer to the components README, not the docs on the website (we're planning to move components docs there too)
Ah I see, I wasn't aware that the --config flag did not work with Serverless Components.
Do you think this flag could be disabled when a Serverless Component is detected or at least the CLI could log a warning about it?
Happy to work on a PR if you can point me in the general direction of where this logic lives in the codebase.