1
votes

I was getting the below error while deploying the lambda on AWS using bitbucket pipeline

Error: Could not set up basepath mapping. Try running sls create_domain first.

Error: 'staging-api.simple.touchsuite.com' could not be found in API Gateway.

ConfigError: Missing region in config

at getDomain.then.then.catch (/opt/atlassian/pipelines/agent/build/node_modules/serverless-domain-manager/index.js:181:15)
at
at runMicrotasksCallback (internal/process/next_tick.js:121:5)
at _combinedTickCallback (internal/process/next_tick.js:131:7)
at process._tickDomainCallback (internal/process/next_tick.js:218:9)

For debugging logs, run again after setting the "SLS_DEBUG=*" environment variable.

Get Support
Docs: docs.serverless.com Bugs: github.com/serverless/serverless/issues Issues: forum.serverless.com

Your Environment Information
Operating System: linux Node Version: 8.10.0
Framework Version: 1.61.3
Plugin Version: 3.2.7
SDK Version: 2.3.0
Components Core Version: 1.1.2
Components CLI Version: 1.4.0

So, I updated the serverless-domain-manager to the newest version 3.3.1

I tried to deploy the lambda after updating the serverless-domain-manager and now I am getting the below error.

Serverless Error

Serverless plugin "serverless-domain-manager" not found. Make sure it's installed and listed in the "plugins" section of your serverless config file.

serverless.yml snippet

plugins:
  - serverless-plugin-warmup
  - serverless-offline
  - serverless-log-forwarding
  - serverless-domain-manager

custom:
  warmup:
    schedule: 'cron(0/10 12-23 ? * MON-FRI *)'
    prewarm: true
  headers:
    - Content-Type
    - X-Amz-Date
    - Authorization
    - X-Api-Key
    - X-Amz-Security-Token
    - TS-Staging
    - x-tss-correlation-id
    - x-tss-application-id

  stage: ${opt:stage, self:provider.stage}
  domains:
    prod: api.simple.touchsuite.com
    staging: staging-api.simple.touchsuite.com
    dev: dev-api.simple.touchsuite.com
  customDomain:
    basePath: 'svc'
    domainName: ${self:custom.domains.${self:custom.stage}}
    stage: ${self:custom.stage}

bitbucket-pipeline.yml snippet

image: node:8.10.0

pipelines:
  branches:
    master:
      - step:
          caches:
            - node
          name: Run tests
          script:
            - npm install --global copy
            - npm install
            - NODE_ENV=test npm test
      - step:
          caches:
            - node
          name: Deploy to Staging
          deployment: staging   # set to test, staging or production
          script:
            - npm install --global copy
            - npm run deploy:staging
            - npm run deploy:integrations:staging
            - node -e 'require("./scripts/bitbucket.js").triggerPipeline()'

Need some insight, what am I missing that creating the error

1

1 Answers

1
votes

I have found with Bitbucket I needed to add an npm install command to make sure that my modules and the plugins were all installed before trying to run them. This may be what is missing in your case. You can also turn caching on for the resulting node_modules folder so that it doesn't have to download all modules every time you deploy.