-
I'm trying to migrage from serverless version 2 to 3. MY SETTINGSserverless.ymlMy version 2service:
name: sample_service
provider:
name: aws
stage: ${opt:stage, self:custom.defaultStage}
region: ap-northeast-1
custom:
defaultStage: test
resources:
- ${file(./resources/${self:provider.stage}/A.yml)}
- ${file(./resources/${self:provider.stage}/B.yml)}
version 3frameworkVersion: '3'
service: sample_service
provider:
name: aws
stage: ${opt:stage, self:custom.defaultStage}
region: ap-northeast-1
custom:
defaultStage: test
resources:
- ${file(./resources/${self:provider.stage}/A.yml)}
- ${file(./resources/${self:provider.stage}/B.yml)}
pacage structure
When I deploy serverless, I set stage based on stages # test
sls deploy --stage test
# production
sls deploy --stage production RESULTS AND PROBLEMSWhen I deploy result version 2I got warining like below, but the deployment succeded A valid file to satisfy the declaration 'file(./resources/production/B.yml)' could not be found. result version 3Deployment is failing with no detail messages. Error:
--
Cannot resolve serverless.yml: Variables resolution errored with:
Cannot resolve variable at "resources.10": Value not found at "file" source,
[Container] Command did not exit successfully serverless print exit status 1 Any reference information like serverless option, package structure and so on would be appreciated. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
https://www.serverless.com/framework/docs/guides/upgrading-v3#new-variable-resolver-engine
Your error might be because of this change. In v2 it was just giving a warning and proceeding to deploy without considering that file. |
Beta Was this translation helpful? Give feedback.
-
Finally, I have split serverless.yml file into each environment files. Here is one expamle. package structure
In deploying, executing following commands
Thank you for help in resolving the issue. I'll be grad that my sample is helpful to the migration |
Beta Was this translation helpful? Give feedback.
Finally, I have split serverless.yml file into each environment files.
In deploy process, renaming each environment files to
serverless.yml
Here is one expamle.
package structure
In deploying, executing following commands
Thank you for help in resolving the issue.
I'll be grad that my sample is helpful to the migration