amplify-education / serverless-domain-manager

Serverless plugin for managing custom domains with API Gateways.
MIT License
936 stars 235 forks source link

Plugin configuration is missing #492

Closed ken-harris closed 2 years ago

ken-harris commented 2 years ago

Community Note

Bug Report

Error Description When I run the command sls deploy --stage qa --region us-west-2 I am greeted to an error message that says "Plugin configuration is missing".

Command Run sls deploy --stage qa --region us-west-2

Console Output

Error: Serverless Domain Manager: Plugin configuration is missing.
      at ServerlessCustomDomain.validateConfigExists (C:\dev\repos\post_transaction_services\packages\satp\node_modules\serverless-domain-manager\dist\src\index.js:81:19)
      at ServerlessCustomDomain.<anonymous> (C:\dev\repos\post_transaction_services\packages\satp\node_modules\serverless-domain-manager\dist\src\index.js:62:18)
      at Generator.next (<anonymous>)
      at C:\dev\repos\post_transaction_services\packages\satp\node_modules\serverless-domain-manager\dist\src\index.js:8:71
      at new Promise (<anonymous>)
      at __awaiter (C:\dev\repos\post_transaction_services\packages\satp\node_modules\serverless-domain-manager\dist\src\index.js:4:12)
      at ServerlessCustomDomain.hookWrapper (C:\dev\repos\post_transaction_services\packages\satp\node_modules\serverless-domain-manager\dist\src\index.js:60:16)
      at PluginManager.invoke (C:\dev\repos\post_transaction_services\packages\satp\node_modules\serverless\lib\classes\PluginManager.js:502:20)
      at runMicrotasks (<anonymous>)
      at processTicksAndRejections (internal/process/task_queues.js:93:5)
      at PluginManager.run (C:\dev\repos\post_transaction_services\packages\satp\node_modules\serverless\lib\classes\PluginManager.js:541:5)
      at Serverless.run (C:\dev\repos\post_transaction_services\packages\satp\node_modules\serverless\lib\Serverless.js:275:5)

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

Domain Manager Configuration Replace this with your own serverless.yml file (anonymized, of course) to help us better resolve your issue.

service:
  name: sales-service

plugins:
  - serverless-webpack
  - serverless-offline
  - serverless-prune-plugin
  - serverless-dotenv-plugin
  - serverless-domain-manager

provider:
  name: aws
  runtime: nodejs14.x
  region: ${opt:region}
  stage: ${opt:stage}
  version: v1
  custom:
    customDomain:
      domainName: example.com
      basePath: transprocessing
      stage: qa
      createRoute53Record: false
      createRoute53IPv6Record: false
      endpointType: 'regional'
      securityPolicy: tls_1_2
    prune:
      automatic: true
      number: 1
  stackName: ${self:service.name}-${self:provider.stage}-cloudFormation-stack
  apiName: ${self:service.name}-${self:provider.stage}
  timeout: 300
  iamRoleStatements:
    - Action:
        - xray:PutTraceSegments
        - xray:PutTelemetryRecords
      Resource:
        - '*'
      Effect: Allow
    - Action:
        - ssm:GetParameter
        - ssm:GetParameters
      Resource: '*'
      Effect: Allow
  buildStage: ${opt:stage, self:provider.stage}
  buildEnvironment:
    us-east-1:
      LAMBDA_SUBNET_1:
        qa: subnet-abc1
      LAMBDA_SUBNET_2:
        qa: subnet-abc2
      LAMBDA_SUBNET_3:
        qa: subnet-abc3
      LAMBDA_SECURITY_GROUP:
        qa: sg-abc4
      SQS_ARN:
        qa: arn:aws:sqs:us-east-1:1234:sqs-qa
      SNS_ARN:
        qa: arn:aws:sns:us-east-1:1234:sns-qa
      S3_BUCKET: log-bucket-${self:provider.buildStage}
      S3_ERROR: error-bucket-${self:provider.buildStage}
    us-west-2:
      LAMBDA_SUBNET_1:
        qa: subnet-abc4
      LAMBDA_SUBNET_2:
        qa: subnet-abc5
      LAMBDA_SUBNET_3:
        qa: subnet-abc6
      LAMBDA_SECURITY_GROUP:
        qa: sg-abc7
      SQS_ARN:
        qa: arn:aws:sqs:us-west-2:1234:sqs-qa
      SNS_ARN:
        qa: arn:aws:sns:us-west-2:1234:sns-qa
      S3_BUCKET: log-bucket-${self:provider.buildStage}-west
      S3_ERROR: error-bucket-${self:provider.buildStage}-west
  environment:
    SNS_TOPIC_ARN: ${self:provider.buildEnvironment.${self:provider.region}.SNS_ARN.${self:provider.buildStage}}
    BUILD_STAGE: ${self:provider.buildStage}
    API_VERSION: ${self:provider.version}
    API_SERVICE_NAME: ${self:service.name}
    MAX_STORE_TRANSACTIONS: 75
    MAX_STORE_MIGRATE: 300
    LOG_LEVEL: info
    REGION: ${self:provider.region}
functions:
  function1:
      handler: handler.function1
      events:
        - sqs: ${self:provider.buildEnvironment.${self:provider.region}.SQS_ARN.${self:provider.buildStage}}
      vpc:
        securityGroupIds:
          - ${self:provider.buildEnvironment.${self:provider.region}.LAMBDA_SECURITY_GROUP.${self:provider.buildStage}}
        subnetIds:
          - ${self:provider.buildEnvironment.${self:provider.region}.LAMBDA_SUBNET_1.${self:provider.buildStage}}
          - ${self:provider.buildEnvironment.${self:provider.region}.LAMBDA_SUBNET_2.${self:provider.buildStage}}
          - ${self:provider.buildEnvironment.${self:provider.region}.LAMBDA_SUBNET_3.${self:provider.buildStage}}

Versions

Possible Solution N/A

Additional context/Screenshots We have another project that uses this custom domain and so it already exists.

ken-harris commented 2 years ago

My apologies. I meant to remove the bug label and it appears I can't do that after I created the post.

rddimon commented 2 years ago

Hi @ken-harris

Could you please take a look at the README?

custom:
    customDomain:

Is not a part of the provider option it's a separate bock

Here is an example

ken-harris commented 2 years ago

@rddimon I am such a fool. I never looked at a full yml file as always just assumed it was part of the provider block because of reasons unknown to me. Ugh I hate how much time I spent trying to figure this out... Thank you very much for the reply though! I appreciate it.