components icon indicating copy to clipboard operation
components copied to clipboard

Template instances must use the same org, app & stage properties

Open gjgd opened this issue 3 years ago • 4 comments

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

gjgd avatar Jan 03 '21 15:01 gjgd

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

gjgd avatar Jan 03 '21 15:01 gjgd

Temporarily solved by not using --config:

In package.json:

  "scripts": {
    "deploy:dev": "cd dev && sls deploy && cd -",
    "deploy:prod": "cd prod && sls deploy && cd -"
  }

gjgd avatar Jan 03 '21 15:01 gjgd

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)

eahefnawy avatar Jan 04 '21 14:01 eahefnawy

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.

gjgd avatar Jan 04 '21 15:01 gjgd