snet-marketplace-service icon indicating copy to clipboard operation
snet-marketplace-service copied to clipboard

Deploy wallet service serverless functions in AWS throws - Error: Cannot resolve serverless.yml

Open ssmtariq opened this issue 1 year ago • 0 comments

I was trying to deploy serverless functions of the wallet service in AWS but ended up with the following exceptions.

The command used: sls deploy The error produced

Environment: linux, node 14.21.3, framework 3.33.0, plugin 6.2.3, SDK 4.3.2
Docs:        docs.serverless.com
Support:     forum.serverless.com
Bugs:        github.com/serverless/serverless/issues

Error:
Cannot resolve serverless.yml: Variables resolution errored with:
  - Cannot resolve variable at "provider.region": Value not found at "file" source,
  - Cannot resolve variable at "functions.wallets.role": Value not found at "file" source,
  - Cannot resolve variable at "functions.wallets.tags.Environment": Value not found at "file" source,
  - Cannot resolve variable at "functions.wallets.tags.Team": Value not found at "file" source,
  - Cannot resolve variable at "functions.wallets.tags.Owner": Value not found at "file" source,
  - Cannot resolve variable at "functions.wallets.vpc.securityGroupIds.0": Value not found at "file" source,
  - Cannot resolve variable at "functions.wallets.vpc.securityGroupIds.1": Value not found at "file" source,
  - Cannot resolve variable at "functions.wallets.vpc.subnetIds.0": Value not found at "file" source,
  - Cannot resolve variable at "functions.wallets.vpc.subnetIds.1": Value not found at "file" source

It seems to be the config*.json file accessed as ${file(./config.. from the serverless.yml doesn't exist in the system. The serverless.yml file is provided below

plugins:
  - serverless-offline
  - serverless-python-requirements
  - serverless-plugin-tracing
  - serverless-prune-plugin
  - serverless-aws-documentation

service: wallets
custom:
  pythonRequirements:
    fileName: wallets/requirements.txt
    dockerizePip: true
    useDownloadCache: true
    useStaticCache: true
    cacheLocation: '/var/cache/serverless'
  prune:
    automatic: true
    includeLayers: true
    number: 2
provider:
  name: aws
  runtime: python3.7
  description: Dapp user service# optional, Description to publish to AWS
  memorySize: 128
  timeout: 30
  region: ${file(./config.${self:provider.stage}.json):REGION}
  stage: ${opt:stage,'dev'}
  deploymentBucket:
    name: snet-serverless-artifacts # Deployment bucket name. Default is generated by the framework
    serverSideEncryption: AES256 # when using server-side encryption
    tags: # Tags that will be added to each of the deployment resources
      key1: wallets
  deploymentPrefix: serverless
  versionFunctions

I cannot find any such file ./config*.json here. Can anyone please suggest how to fix this?

ssmtariq avatar Jul 10 '23 14:07 ssmtariq