laardee / serverless-authentication-boilerplate

Generic authentication boilerplate for Serverless framework
http://laardee.github.io/serverless-authentication-gh-pages
MIT License
569 stars 72 forks source link

Getting errors when do serverless deploy #50

Closed nguyenlocduy closed 6 years ago

nguyenlocduy commented 6 years ago
serverless deploy --verbose

<--- Last few GCs --->

   57874 ms: Scavenge 1323.2 (1434.4) -> 1323.2 (1434.4) MB, 24.8 / 0 ms [allocation failure].
   57899 ms: Scavenge 1323.2 (1434.4) -> 1323.2 (1434.4) MB, 24.7 / 0 ms [allocation failure].
   57924 ms: Scavenge 1323.2 (1434.4) -> 1323.2 (1434.4) MB, 25.0 / 0 ms [allocation failure].
   57949 ms: Scavenge 1323.2 (1434.4) -> 1323.2 (1434.4) MB, 24.8 / 0 ms [allocation failure].
   57973 ms: Scavenge 1323.2 (1434.4) -> 1323.2 (1434.4) MB, 24.8 / 0 ms [allocation failure].

<--- JS stacktrace --->
Cannot get stack trace in GC.
FATAL ERROR: Scavenger: semi-space copy
 Allocation failed - process out of memory
[1]    47248 abort      serverless deploy --verbose
nileshdt commented 6 years ago

I am getting the same errors aswell.

cedric25 commented 6 years ago

I was facing the same issue with serverless 1.18.1 or 1.19.0. Using a 1.9.0 unblocked me.

ValkyrieUK commented 6 years ago

I had to nest the environment object inside the custom section.

  custom:
    environment: ${file(./env.yml):${opt:stage, self:provider.stage}}

And then reference variables like so.

TableName: ${self:provider.custom.environment.CACHE_DB_NAME}

I also changes the env.yaml file too something like this.

# variables for "dev" stage
dev:
# General
  SERVICE: ${self:service}
  STAGE: ${opt:stage, self:provider.stage}
  REGION: ${opt:region, self:provider.region}
  REDIRECT_CLIENT_URI: http://127.0.0.1:3000/
  TOKEN_SECRET: token-secret-123
# Database
  CACHE_DB_NAME: ${self:service}-cache-${opt:stage, self:provider.stage}
  USERS_DB_NAME: ${self:service}-users-${opt:stage, self:provider.stage}
# Cognito
  USER_POOL_ID: eu-west-mypool-id
# Providers
  PROVIDER_FACEBOOK_ID: fb-mock-id
  PROVIDER_FACEBOOK_SECRET: fb-mock-secret
  PROVIDER_GOOGLE_ID: g-mock-id
  PROVIDER_GOOGLE_SECRET: cg-mock-secret
  PROVIDER_MICROSOFT_ID: ms-mock-id
  PROVIDER_MICROSOFT_SECRET: ms-mock-secret
  PROVIDER_CUSTOM_GOOGLE_ID: g-mock-id
  PROVIDER_CUSTOM_GOOGLE_SECRET: cg-mock-secret

Then when deploying pass in stage and region flags.

sls deploy --stage dev --region eu-west-1

Now it seems to be working fine for me.

nileshdt commented 6 years ago

Thanks @Valkyrie. I am able to proceed cheers

ValkyrieUK commented 6 years ago

@laardee Is this something you have come across? If so I'm happy to submit a PR with my suggested changes.

zorpheux commented 6 years ago

@laardee I fixed my own issue using your observation above. Would be nice if you'd submit a PR.

laardee commented 6 years ago

Thanks for reporting. I somehow missed totally this issue, sorry. I'll check this as soon as possible.

ValkyrieUK commented 6 years ago

@laardee Nice one man. Looks like it might some sort of circular dependency issue.