Skip to content

SNS schema validation fails with string : wrong Fn::Sub definition #8173

Description

@fredericbarthelet

Since #8112 , when using sns.arn with a string, the schema validation fails.
This is due to the fact that :

  • this property is required to be either a string starting with arn: or any CF function - exclusively
  • CF function Fn::Sub schema specify it can be a string (this is the problem)
  • both schema are matched when using any string starting with arn:, thus resulting in a schema violation
serverless.ts
import type AWS from 'serverless/aws';

const serverlessConfiguration: AWS.Serverless = {
  service: {
    name: 'tmp',
  },
  configValidationMode: 'error',
  custom: {
    webpack: {
      webpackConfig: './webpack.config.js',
      includeModules: true
    }
  },
  plugins: ['serverless-webpack'],
  provider: {
    name: 'aws',
    runtime: 'nodejs12.x',
  },
  functions: {
    hello: {
      handler: 'handler.hello',
      events: [
        {
          sns: {
            arn: 'arn:123'
          }
        }
      ]
    }
  }
}

module.exports = serverlessConfiguration;
sls deploy output
  Serverless Error ---------------------------------------

  Configuration error at 'functions.hello.events[0].sns.arn': unsupported configuration format

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

  Your Environment Information ---------------------------
     Operating System:          darwin
     Node Version:              12.13.0
     Framework Version:         1.80.0
     Plugin Version:            3.8.1
     SDK Version:               2.3.1
     Components Version:        2.34.9

Installed version

Framework Core: 1.80.0
Plugin: 3.8.1
SDK: 2.3.1
Components: 2.34.9

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions