trek10inc / serverless-secrets

An opinionated tool for safely managing and deploying Serverless projects and their secrets.
Other
165 stars 27 forks source link

.serverless-secrets.json not added to package #23

Closed urossmolnik closed 7 years ago

urossmolnik commented 7 years ago

AWS Lambda function is exiting with error:

Unable to import module 'handler': Error
at Function.Module._resolveFilename (module.js:469:15)
at Function.Module._load (module.js:417:25)
at Module.require (module.js:497:17)
at require (internal/module.js:20:19)
at Object.<anonymous> (/var/task/node_modules/serverless-secrets/client/index.js:6:17)
at Module._compile (module.js:570:32)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)

I checked what client/index is loading and it is .serverless-secrets.json.
Then I checked package on S3 and .serverless-secrets.json is not bundled.

My serverless.yml looks like this:

provider:
  name: aws
  runtime: nodejs6.10
  region: us-east-1
  stage: ${opt:stage, 'dev'}
  environmentSecrets:
    SECRET_NAME: /somepath/${opt:stage, 'dev'}/SECRET_NAME

custom:
  serverlessSecrets:
    providerOptions:
      region: us-east-1
    throwOnMissingSecret: true

Offline mode works.

These are deploy logs:

Serverless: Generating Serverless Secrets Config
Serverless: Compiling with Typescript...
Serverless: Using local tsconfig.json
Serverless: Typescript compiled.
Serverless: Serverless Secrets beginning packaging process
Serverless: Writing .serverless-secrets.json
Serverless: Validating secrets
Serverless: Secrets validated
Serverless: Adding environment variable placeholders for Serverless Secrets
Serverless: Packaging service...
Serverless: Excluding development dependencies...
Serverless: Cleaning up .serverless-secrets.json
Serverless: Uploading CloudFormation file to S3...
Serverless: Uploading artifacts...
Serverless: Uploading service .zip file to S3 (11.66 MB)...
Serverless: Validating template...
Serverless: Updating Stack...
Serverless: Checking Stack update progress...

Version: 3.0.0-beta.10

urossmolnik commented 7 years ago

It was plugin order reason.
Has to be added before serverless-plugin-typescript.
Closing this.