Code Monkey home page Code Monkey logo

serverless-plugin-modularize's People

Contributors

humodz avatar icarus-sullivan avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar

serverless-plugin-modularize's Issues

Property reference resolution implemented?

I'm not having any luck with variable resolution on merged serverless configs using this plugin.

I have one lerna monorepo project with two services, both tested and deploying successfully independently, but when merged with modularize, I get cloudwatch errors like the below:

1 validation error detected: Value '${self:provider.environment.DYNAMODB_TABLE}' at 'tableName' failed to satisfy constraint:

Here's my root serverless.yml file

service: my-funky-service

unresolvedVariablesNotificationMode: error
configValidationMode: error

plugins:
  - serverless-plugin-modularize

custom:
  modularize:
    glob: './services/*/serverless.yml'

provider:
  name: aws
  runtime: nodejs14.x
  region: eu-west-2
  lambdaHashingVersion: 20201221
  environment:
    NODE_ENV: "production"

I noticed there aren't any variables in your examples to test this with, so am I correct in thinking this is a missing feature?

Modularize plugin not merging custom.appSync.dataSources correctly

Modularize plugin not merging custom.appSync.dataSources correctly similarly custom.appSync.mappingTemplates
image

I had to uninstall modularize today because it wasn't merging those correctly

Only one of those would be present in the serverless.json and the rest weren't there

Resources are not merged together

Despite what the Readme says, the plugin does not seem to actually merge the resources section of the modules:

have hello.module.yml define a resource section with a DynamoDB table

resources: 
  Resources:
      usersTable:
        Type: AWS::DynamoDB::Table
        Properties:
          TableName: usersTable
          AttributeDefinitions:
            - AttributeName: email
              AttributeType: S
          KeySchema:
            - AttributeName: email
              KeyType: HASH
          ProvisionedThroughput:
            ReadCapacityUnits: 1
            WriteCapacityUnits: 1

have goodbye.module.yml define a resource section with another DynamoDB table:

resources: 
  Resources:
      carsTable:
        Type: AWS::DynamoDB::Table
        Properties:
          TableName: carsTable
          AttributeDefinitions:
            - AttributeName: registration
              AttributeType: S
          KeySchema:
            - AttributeName: registration
              KeyType: HASH
          ProvisionedThroughput:
            ReadCapacityUnits: 1
            WriteCapacityUnits: 1

then run the serverless deploy: the stack will contain only the resources of the last module loaded.

Outputs (inside the "resources" section) are not merged together

Apologies for the 1-2 of issues raised - I normally don't use Outputs but there's always the one rogue project that does things differently from the rest of the stack

This is definitely related to issue #2 : using version 1.0.6 (thanks for the fix BTW, really appreciated) now the resources section of the resulting merged yaml contains the correct Resources, but no Outputs
See the bottom of this reference for an example of Outputs:
https://www.serverless.com/framework/docs/providers/aws/guide/serverless.yml/

I think the fix would be the same thing done for Resources in merge.js

  resources: {
    Resources: {
      ...get(a, 'resources.Resources', {}),
      ...get(b, 'resources.Resources', {}),
    },
    Outputs: {
      ...get(a, 'resources.Outputs', {}),
      ...get(b, 'resources.Outputs', {}),
    },

Variables not resolving in modularized templates after upgrading to variablesResolutionMode

After upgrading to variablesResolutionMode: 20210326 in Serverless 2, or upgrading to Serverless 3, I'm now getting errors when trying to use native serverless variables such as ${aws:region}, ${aws:accountId}, ${ApiGatewayRestApi}, and ${sls:stage}, as well as custom variables such as ${self:custom.deletionPolicy}. These work correctly in the root serverless.yml but aren't resolved in the modularized templates.

The CloudFormation template is invalid: Template format error: Unresolved resource dependencies [aws:accountId, sls:stage, aws:region] in the Resources block of the template
The CloudFormation template is invalid: Template format error: Unrecognized DeletionPolicy ${self:custom.deletionPolicy} for resource CognitoUserPool

Modularize doesn't work if the `serverless.yml` doesn't have any functions

I created an example here:
https://github.com/Shereef/modularize-issue
Versions:

    "serverless": "^3.2.0",
    "serverless-plugin-modularize": "^2.0.0",

The modularize merged shows functions correctly but when you deploy it doesn't have functions at all
serverless.yml

service: some-booking-service

plugins:
  - serverless-plugin-modularize

provider:
  name: aws
  runtime: nodejs14.x
  memorySize: 128
  timeout: 120
  region: ${opt:region, "us-east-1"}

custom:
  modularize:
    glob: "src/**/*.module.yml" # glob pattern

src/health/serverless.module.yml

functions:
  healthCheck:
    handler: dist/src/health/handler.check
  healthVersion:
    handler: dist/src/health/handler.version
Shmac:modularize-issue shereef.marzouk$ npm run deploy

> [email protected] deploy
> npm run build && sls deploy --stage sandbox --aws-profile sandbox --verbose


> [email protected] build
> tsc --build --verbose --pretty

[4:32:34 AM] Projects in this build: 
    * tsconfig.json

[4:32:34 AM] Project 'tsconfig.json' is up to date because newest input 'src/shared/functions.ts' is older than oldest output 'dist/src/shared/functions.js'


Deploying some-booking-service to stage sandbox (us-east-1)

Packaging
Retrieving CloudFormation stack
Creating CloudFormation stack
Creating new change set
Waiting for new change set to be created
Change Set did not reach desired state, retrying
Executing created change set
  CREATE_IN_PROGRESS - AWS::CloudFormation::Stack - some-booking-service-sandbox
  CREATE_IN_PROGRESS - AWS::S3::Bucket - ServerlessDeploymentBucket
  CREATE_IN_PROGRESS - AWS::S3::Bucket - ServerlessDeploymentBucket
  CREATE_COMPLETE - AWS::S3::Bucket - ServerlessDeploymentBucket
  CREATE_IN_PROGRESS - AWS::S3::BucketPolicy - ServerlessDeploymentBucketPolicy
  CREATE_IN_PROGRESS - AWS::S3::BucketPolicy - ServerlessDeploymentBucketPolicy
  CREATE_COMPLETE - AWS::S3::BucketPolicy - ServerlessDeploymentBucketPolicy
  CREATE_COMPLETE - AWS::CloudFormation::Stack - some-booking-service-sandbox
Uploading
Uploading CloudFormation file to S3
Updating CloudFormation stack
Creating new change set
Waiting for new change set to be created
Change Set did not reach desired state, retrying
Change Set did not reach desired state, retrying
Executing created change set
  UPDATE_IN_PROGRESS - AWS::CloudFormation::Stack - some-booking-service-sandbox
  UPDATE_COMPLETE_CLEANUP_IN_PROGRESS - AWS::CloudFormation::Stack - some-booking-service-sandbox
  UPDATE_COMPLETE - AWS::CloudFormation::Stack - some-booking-service-sandbox
Retrieving CloudFormation stack
Removing old service artifacts from S3

✔ Service deployed to stack some-booking-service-sandbox (67s)


Stack Outputs:
  ServerlessDeploymentBucketName: some-booking-service-san-serverlessdeploymentbuck-16kzaq4d88sbb
Shmac:modularize-issue shereef.marzouk$ npx serverless modularize info
modularize: src/health/serverless.module.yml 
 {
  "functions": {
    "healthCheck": {
      "handler": "dist/src/health/handler.check"
    },
    "healthVersion": {
      "handler": "dist/src/health/handler.version"
    }
  }
} 

Shmac:modularize-issue shereef.marzouk$ npx serverless modularize merged
modularize: {
  "plugins": [
    "serverless-plugin-modularize"
  ],
  "custom": {
    "modularize": {
      "glob": "src/**/*.module.yml"
    }
  },
  "provider": {
    "name": "aws",
    "runtime": "nodejs14.x",
    "memorySize": 128,
    "timeout": 120,
    "region": "us-east-1",
    "stage": "dev",
    "versionFunctions": true
  },
  "functions": {
    "healthCheck": {
      "handler": "dist/src/health/handler.check"
    },
    "healthVersion": {
      "handler": "dist/src/health/handler.version"
    }
  }
}
Shmac:modularize-issue shereef.marzouk$ 

if I change my serverless.yml to be:

service: some-booking-service

plugins:
  - serverless-plugin-modularize

provider:
  name: aws
  runtime: nodejs14.x
  memorySize: 128
  timeout: 120
  region: ${opt:region, "us-east-1"}

custom:
  modularize:
    glob: "src/**/*.module.yml" # glob pattern

functions:
  healthCheck:
    handler: dist/src/health/handler.check

it works fine:

Shmac:modularize-issue shereef.marzouk$ npm run deploy

> [email protected] deploy
> npm run build && sls deploy --stage sandbox --aws-profile sandbox --verbose


> [email protected] build
> tsc --build --verbose --pretty

[5:10:14 AM] Projects in this build: 
    * tsconfig.json

[5:10:14 AM] Project 'tsconfig.json' is up to date because newest input 'src/shared/functions.ts' is older than oldest output 'dist/src/shared/functions.js'


Deploying some-booking-service to stage sandbox (us-east-1)

Packaging
Excluding development dependencies for service package
Retrieving CloudFormation stack
Creating CloudFormation stack
Creating new change set
Waiting for new change set to be created
Change Set did not reach desired state, retrying
Executing created change set
  CREATE_IN_PROGRESS - AWS::CloudFormation::Stack - some-booking-service-sandbox
  CREATE_IN_PROGRESS - AWS::S3::Bucket - ServerlessDeploymentBucket
  CREATE_IN_PROGRESS - AWS::S3::Bucket - ServerlessDeploymentBucket
  CREATE_COMPLETE - AWS::S3::Bucket - ServerlessDeploymentBucket
  CREATE_IN_PROGRESS - AWS::S3::BucketPolicy - ServerlessDeploymentBucketPolicy
  CREATE_IN_PROGRESS - AWS::S3::BucketPolicy - ServerlessDeploymentBucketPolicy
  CREATE_COMPLETE - AWS::S3::BucketPolicy - ServerlessDeploymentBucketPolicy
  CREATE_COMPLETE - AWS::CloudFormation::Stack - some-booking-service-sandbox
Uploading
Uploading CloudFormation file to S3
Uploading service some-booking-service.zip file to S3 (1.35 MB)
Updating CloudFormation stack
Creating new change set
Waiting for new change set to be created
Change Set did not reach desired state, retrying
Change Set did not reach desired state, retrying
Executing created change set
  UPDATE_IN_PROGRESS - AWS::CloudFormation::Stack - some-booking-service-sandbox
  CREATE_IN_PROGRESS - AWS::Logs::LogGroup - HealthVersionLogGroup
  CREATE_IN_PROGRESS - AWS::Logs::LogGroup - HealthCheckLogGroup
  CREATE_IN_PROGRESS - AWS::IAM::Role - IamRoleLambdaExecution
  CREATE_IN_PROGRESS - AWS::IAM::Role - IamRoleLambdaExecution
  CREATE_IN_PROGRESS - AWS::Logs::LogGroup - HealthVersionLogGroup
  CREATE_IN_PROGRESS - AWS::Logs::LogGroup - HealthCheckLogGroup
  CREATE_COMPLETE - AWS::Logs::LogGroup - HealthVersionLogGroup
  CREATE_COMPLETE - AWS::Logs::LogGroup - HealthCheckLogGroup
  CREATE_COMPLETE - AWS::IAM::Role - IamRoleLambdaExecution
  CREATE_IN_PROGRESS - AWS::Lambda::Function - HealthCheckLambdaFunction
  CREATE_IN_PROGRESS - AWS::Lambda::Function - HealthVersionLambdaFunction
  CREATE_IN_PROGRESS - AWS::Lambda::Function - HealthVersionLambdaFunction
  CREATE_IN_PROGRESS - AWS::Lambda::Function - HealthCheckLambdaFunction
  CREATE_COMPLETE - AWS::Lambda::Function - HealthVersionLambdaFunction
  CREATE_COMPLETE - AWS::Lambda::Function - HealthCheckLambdaFunction
  CREATE_IN_PROGRESS - AWS::Lambda::Version - HealthVersionLambdaVersionw9qKBBv7kmFhL6SaJrpzAGus5fqe2bYJjGh75aDeE
  CREATE_IN_PROGRESS - AWS::Lambda::Version - HealthCheckLambdaVersiony6fb4w1n5wvH9ZgJypCo7Dw8vqm1NOFoBbKrC7kU1c
  CREATE_IN_PROGRESS - AWS::Lambda::Version - HealthVersionLambdaVersionw9qKBBv7kmFhL6SaJrpzAGus5fqe2bYJjGh75aDeE
  CREATE_IN_PROGRESS - AWS::Lambda::Version - HealthCheckLambdaVersiony6fb4w1n5wvH9ZgJypCo7Dw8vqm1NOFoBbKrC7kU1c
  CREATE_COMPLETE - AWS::Lambda::Version - HealthCheckLambdaVersiony6fb4w1n5wvH9ZgJypCo7Dw8vqm1NOFoBbKrC7kU1c
  CREATE_COMPLETE - AWS::Lambda::Version - HealthVersionLambdaVersionw9qKBBv7kmFhL6SaJrpzAGus5fqe2bYJjGh75aDeE
  UPDATE_COMPLETE_CLEANUP_IN_PROGRESS - AWS::CloudFormation::Stack - some-booking-service-sandbox
  UPDATE_COMPLETE - AWS::CloudFormation::Stack - some-booking-service-sandbox
Retrieving CloudFormation stack
Removing old service artifacts from S3

✔ Service deployed to stack some-booking-service-sandbox (101s)

functions:
  healthCheck: some-booking-service-sandbox-healthCheck (1.3 MB)
  healthVersion: some-booking-service-sandbox-healthVersion (1.3 MB)

Stack Outputs:
  HealthCheckLambdaFunctionQualifiedArn: arn:aws:lambda:us-east-1:933922255734:function:some-booking-service-sandbox-healthCheck:5
  HealthVersionLambdaFunctionQualifiedArn: arn:aws:lambda:us-east-1:933922255734:function:some-booking-service-sandbox-healthVersion:5
  ServerlessDeploymentBucketName: some-booking-service-san-serverlessdeploymentbuck-1sjq2ogdo7hz0
Shmac:modularize-issue shereef.marzouk$ 

Modularize failures

The below log is me while just added modularize to the npm and serverless.yml without making any further changes

Deploying some-service to stage sandbox (us-east-1)

Packaging
AppSync Plugin: GraphQl schema valid
Plugins: ["serverless-plugin-git-variables","serverless-prune-plugin","serverless-appsync-plugin","serverless-plugin-modularize","serverless-newrelic-lambda-layers"]
Adding NewRelic layer to helloWorld
Adding NewRelic layer to healthCheck
Adding NewRelic layer to healthVersion
Excluding development dependencies for service package
Existing New Relic integration found for this linked account and aws account, skipping creation.
Retrieving CloudFormation stack
Uploading
Uploading CloudFormation file to S3
Uploading service some-service.zip file to S3 (1.11 MB)
Updating CloudFormation stack
Creating new change set
Waiting for new change set to be created
Change Set did not reach desired state, retrying
Change Set did not reach desired state, retrying
Change Set did not reach desired state, retrying
Executing created change set
  UPDATE_IN_PROGRESS - AWS::CloudFormation::Stack - some-service-sandbox
  CREATE_IN_PROGRESS - AWS::DynamoDB::Table - DynamoDbTable
  UPDATE_IN_PROGRESS - AWS::Lambda::Function - HealthCheckLambdaFunction
  UPDATE_IN_PROGRESS - AWS::Lambda::Function - HealthVersionLambdaFunction
  UPDATE_IN_PROGRESS - AWS::Lambda::Function - HelloWorldLambdaFunction
  CREATE_IN_PROGRESS - AWS::DynamoDB::Table - DynamoDbTable
  UPDATE_IN_PROGRESS - AWS::AppSync::ApiKey - GraphQlApiKeyappSyncApiKey
  UPDATE_COMPLETE - AWS::AppSync::ApiKey - GraphQlApiKeyappSyncApiKey
  CREATE_COMPLETE - AWS::DynamoDB::Table - DynamoDbTable
  UPDATE_COMPLETE - AWS::Lambda::Function - HealthVersionLambdaFunction
  CREATE_IN_PROGRESS - AWS::Lambda::Version - HealthVersionLambdaVersionH8iXTtuszYMsoaIF2fCwg6I0G3v7OT3t6yba15xgOvc
  CREATE_IN_PROGRESS - AWS::Lambda::Version - HealthVersionLambdaVersionH8iXTtuszYMsoaIF2fCwg6I0G3v7OT3t6yba15xgOvc
  UPDATE_COMPLETE - AWS::Lambda::Function - HelloWorldLambdaFunction
  CREATE_COMPLETE - AWS::Lambda::Version - HealthVersionLambdaVersionH8iXTtuszYMsoaIF2fCwg6I0G3v7OT3t6yba15xgOvc
  CREATE_IN_PROGRESS - AWS::Lambda::Version - HelloWorldLambdaVersionUhwzrYK7ylDwHozvZzCzs6MMWEtKKAkIfFr5b9ug4
  CREATE_IN_PROGRESS - AWS::Lambda::Version - HelloWorldLambdaVersionUhwzrYK7ylDwHozvZzCzs6MMWEtKKAkIfFr5b9ug4
  CREATE_COMPLETE - AWS::Lambda::Version - HelloWorldLambdaVersionUhwzrYK7ylDwHozvZzCzs6MMWEtKKAkIfFr5b9ug4
  UPDATE_COMPLETE - AWS::Lambda::Function - HealthCheckLambdaFunction
  CREATE_IN_PROGRESS - AWS::Lambda::Version - HealthCheckLambdaVersionKDqmucmQS2WYfTX0t27F7SznFFGrbtxc9ucrt4k54
  CREATE_IN_PROGRESS - AWS::Lambda::Version - HealthCheckLambdaVersionKDqmucmQS2WYfTX0t27F7SznFFGrbtxc9ucrt4k54
  CREATE_COMPLETE - AWS::Lambda::Version - HealthCheckLambdaVersionKDqmucmQS2WYfTX0t27F7SznFFGrbtxc9ucrt4k54
  UPDATE_COMPLETE_CLEANUP_IN_PROGRESS - AWS::CloudFormation::Stack - some-service-sandbox
  DELETE_SKIPPED - AWS::Lambda::Version - HealthVersionLambdaVersionZTd07fkZWTaMxoezZpk813Kmcwkb9IlUCaFbCOjqFY
  DELETE_SKIPPED - AWS::Lambda::Version - HelloWorldLambdaVersion76867YHA8GQPNYaNAEbKDPRleIfy9q5GPd8dGsWn8s
  DELETE_SKIPPED - AWS::Lambda::Version - HealthCheckLambdaVersionsvz6QZS0pKBjcQlsl6wxe0W3cjMvqMdH9AcGF4lRZM
  UPDATE_COMPLETE - AWS::CloudFormation::Stack - some-service-sandbox
Retrieving CloudFormation stack
appsync api keys:
  da2-aijrntzqb5ettc5juclixuldpm
appsync endpoints:
  https://mjdmoshdpjfbxpdt57jupqzmqi.appsync-api.us-east-1.amazonaws.com/graphql
Deleting function version some-service-sandbox-helloWorld:42.
Deleting function version some-service-sandbox-healthCheck:12.
Deleting function version some-service-sandbox-healthVersion:12.
✔ Pruning of functions complete
log filter: 
Configuring New Relic log subscription for helloWorld
Configuring New Relic log subscription for healthCheck
Configuring New Relic log subscription for healthVersion
Found log subscription for some-service-sandbox-healthCheck, verifying configuration
Found log subscription for some-service-sandbox-helloWorld, verifying configuration
Found log subscription for some-service-sandbox-healthVersion, verifying configuration
Removing old service artifacts from S3

✔ Service deployed to stack some-service-sandbox (133s)

functions:
  helloWorld: some-service-sandbox-helloWorld (1.1 MB)
  healthCheck: some-service-sandbox-healthCheck (1.1 MB)
  healthVersion: some-service-sandbox-healthVersion (1.1 MB)

Stack Outputs:
  HelloWorldLambdaFunctionQualifiedArn: arn:aws:lambda:us-east-1:*************:function:some-service-sandbox-helloWorld:45
  HealthCheckLambdaFunctionQualifiedArn: arn:aws:lambda:us-east-1:*************:function:some-service-sandbox-healthCheck:15
  GraphQlApiUrl: https://mjdmoshdpjfbxpdt57jupqzmqi.appsync-api.us-east-1.amazonaws.com/graphql
  HealthVersionLambdaFunctionQualifiedArn: arn:aws:lambda:us-east-1:*************:function:some-service-sandbox-healthVersion:15
  GraphQlApiKeyappSyncApiKey: da2-*******************
  GraphQlApiId: ****************************
  ServerlessDeploymentBucketName: some-service-serverlessdeploymentbuck-************
```Deploying some-service to stage sandbox (us-east-1)

Packaging
AppSync Plugin: GraphQl schema valid
Plugins: ["serverless-plugin-git-variables","serverless-prune-plugin","serverless-appsync-plugin","serverless-plugin-modularize","serverless-newrelic-lambda-layers"]
Adding NewRelic layer to helloWorld
Adding NewRelic layer to healthCheck
Adding NewRelic layer to healthVersion
Excluding development dependencies for service package
Existing New Relic integration found for this linked account and aws account, skipping creation.
Retrieving CloudFormation stack
Uploading
Uploading CloudFormation file to S3
Uploading service some-service.zip file to S3 (1.11 MB)
Updating CloudFormation stack
Creating new change set
Waiting for new change set to be created
Change Set did not reach desired state, retrying
Change Set did not reach desired state, retrying
Change Set did not reach desired state, retrying
Executing created change set
  UPDATE_IN_PROGRESS - AWS::CloudFormation::Stack - some-service-sandbox
  CREATE_IN_PROGRESS - AWS::DynamoDB::Table - DynamoDbTable
  UPDATE_IN_PROGRESS - AWS::Lambda::Function - HealthCheckLambdaFunction
  UPDATE_IN_PROGRESS - AWS::Lambda::Function - HealthVersionLambdaFunction
  UPDATE_IN_PROGRESS - AWS::Lambda::Function - HelloWorldLambdaFunction
  CREATE_IN_PROGRESS - AWS::DynamoDB::Table - DynamoDbTable
  UPDATE_IN_PROGRESS - AWS::AppSync::ApiKey - GraphQlApiKeyappSyncApiKey
  UPDATE_COMPLETE - AWS::AppSync::ApiKey - GraphQlApiKeyappSyncApiKey
  CREATE_COMPLETE - AWS::DynamoDB::Table - DynamoDbTable
  UPDATE_COMPLETE - AWS::Lambda::Function - HealthVersionLambdaFunction
  CREATE_IN_PROGRESS - AWS::Lambda::Version - HealthVersionLambdaVersionH8iXTtuszYMsoaIF2fCwg6I0G3v7OT3t6yba15xgOvc
  CREATE_IN_PROGRESS - AWS::Lambda::Version - HealthVersionLambdaVersionH8iXTtuszYMsoaIF2fCwg6I0G3v7OT3t6yba15xgOvc
  UPDATE_COMPLETE - AWS::Lambda::Function - HelloWorldLambdaFunction
  CREATE_COMPLETE - AWS::Lambda::Version - HealthVersionLambdaVersionH8iXTtuszYMsoaIF2fCwg6I0G3v7OT3t6yba15xgOvc
  CREATE_IN_PROGRESS - AWS::Lambda::Version - HelloWorldLambdaVersionUhwzrYK7ylDwHozvZzCzs6MMWEtKKAkIfFr5b9ug4
  CREATE_IN_PROGRESS - AWS::Lambda::Version - HelloWorldLambdaVersionUhwzrYK7ylDwHozvZzCzs6MMWEtKKAkIfFr5b9ug4
  CREATE_COMPLETE - AWS::Lambda::Version - HelloWorldLambdaVersionUhwzrYK7ylDwHozvZzCzs6MMWEtKKAkIfFr5b9ug4
  UPDATE_COMPLETE - AWS::Lambda::Function - HealthCheckLambdaFunction
  CREATE_IN_PROGRESS - AWS::Lambda::Version - HealthCheckLambdaVersionKDqmucmQS2WYfTX0t27F7SznFFGrbtxc9ucrt4k54
  CREATE_IN_PROGRESS - AWS::Lambda::Version - HealthCheckLambdaVersionKDqmucmQS2WYfTX0t27F7SznFFGrbtxc9ucrt4k54
  CREATE_COMPLETE - AWS::Lambda::Version - HealthCheckLambdaVersionKDqmucmQS2WYfTX0t27F7SznFFGrbtxc9ucrt4k54
  UPDATE_COMPLETE_CLEANUP_IN_PROGRESS - AWS::CloudFormation::Stack - some-service-sandbox
  DELETE_SKIPPED - AWS::Lambda::Version - HealthVersionLambdaVersionZTd07fkZWTaMxoezZpk813Kmcwkb9IlUCaFbCOjqFY
  DELETE_SKIPPED - AWS::Lambda::Version - HelloWorldLambdaVersion76867YHA8GQPNYaNAEbKDPRleIfy9q5GPd8dGsWn8s
  DELETE_SKIPPED - AWS::Lambda::Version - HealthCheckLambdaVersionsvz6QZS0pKBjcQlsl6wxe0W3cjMvqMdH9AcGF4lRZM
  UPDATE_COMPLETE - AWS::CloudFormation::Stack - some-service-sandbox
Retrieving CloudFormation stack
appsync api keys:
  da2-aijrntzqb5ettc5juclixuldpm
appsync endpoints:
  https://mjdmoshdpjfbxpdt57jupqzmqi.appsync-api.us-east-1.amazonaws.com/graphql
Deleting function version some-service-sandbox-helloWorld:42.
Deleting function version some-service-sandbox-healthCheck:12.
Deleting function version some-service-sandbox-healthVersion:12.
✔ Pruning of functions complete
log filter: 
Configuring New Relic log subscription for helloWorld
Configuring New Relic log subscription for healthCheck
Configuring New Relic log subscription for healthVersion
Found log subscription for some-service-sandbox-healthCheck, verifying configuration
Found log subscription for some-service-sandbox-helloWorld, verifying configuration
Found log subscription for some-service-sandbox-healthVersion, verifying configuration
Removing old service artifacts from S3

✔ Service deployed to stack some-service-sandbox (133s)

functions:
  helloWorld: some-service-sandbox-helloWorld (1.1 MB)
  healthCheck: some-service-sandbox-healthCheck (1.1 MB)
  healthVersion: some-service-sandbox-healthVersion (1.1 MB)

Stack Outputs:
  HelloWorldLambdaFunctionQualifiedArn: arn:aws:lambda:us-east-1:*************:function:some-service-sandbox-helloWorld:45
  HealthCheckLambdaFunctionQualifiedArn: arn:aws:lambda:us-east-1:*************:function:some-service-sandbox-healthCheck:15
  GraphQlApiUrl: https://mjdmoshdpjfbxpdt57jupqzmqi.appsync-api.us-east-1.amazonaws.com/graphql
  HealthVersionLambdaFunctionQualifiedArn: arn:aws:lambda:us-east-1:*************:function:some-service-sandbox-healthVersion:15
  GraphQlApiKeyappSyncApiKey: da2-****************
  GraphQlApiId: *****************
  ServerlessDeploymentBucketName: some-service-serverlessdeploymentbuck-************

Then All I did was move 2 function declarations into /service/src/health/serverless.module.yml and removed them from the root serverless.tml

functions:
    healthCheck:
        handler: dist/src/health/handler.check
    healthVersion:
        handler: dist/src/health/handler.version

This is my glob config:

    modularize:
        glob: 'src/**/*.module.yml'

The deploy fails with the following output

Deploying some-service to stage sandbox (us-east-1)

Packaging
AppSync Plugin: GraphQl schema valid
Plugins: ["serverless-plugin-modularize","serverless-plugin-git-variables","serverless-prune-plugin","serverless-appsync-plugin","serverless-newrelic-lambda-layers"]
Adding NewRelic layer to helloWorld
Excluding development dependencies for service package
Existing New Relic integration found for this linked account and aws account, skipping creation.
Retrieving CloudFormation stack
Uploading
Uploading CloudFormation file to S3
Uploading service some-service.zip file to S3 (1.11 MB)

✖ Stack some-service-sandbox failed to deploy (10s)
Environment: darwin, node 14.18.2, framework 3.0.0 (local), plugin 6.0.0, SDK 4.3.0
Credentials: Local, "sandbox" profile
Docs:        docs.serverless.com
Support:     forum.serverless.com
Bugs:        github.com/serverless/serverless/issues

Error:
The CloudFormation template is invalid: Template error: instance of Fn::GetAtt references undefined resource HealthVersionLambdaFunction

What info do you need ?
I think it's caused by the new relic plugin serverless-newrelic-lambda-layers somehow not being compatible with modularize

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.