Skip to content
This repository has been archived by the owner on Nov 6, 2021. It is now read-only.

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

Closed
urossmolnik opened this issue Oct 22, 2017 · 1 comment
Closed

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

urossmolnik opened this issue Oct 22, 2017 · 1 comment

Comments

@urossmolnik
Copy link

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
Copy link
Author

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

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant