Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't add more than one Lambda trigger to existing Cognito User Pools at a time #6420

Closed
joelvh opened this issue Jul 20, 2019 · 3 comments · Fixed by #6491
Closed

Can't add more than one Lambda trigger to existing Cognito User Pools at a time #6420

joelvh opened this issue Jul 20, 2019 · 3 comments · Fixed by #6491

Comments

@joelvh
Copy link
Contributor

joelvh commented Jul 20, 2019

This is a Bug Report

Description

  • What went wrong?

Specifying more than one Lambda trigger to be added to an existing Cognito User Pool causes an error. The error indicates maybe there's a concurrency issue, when provisioning should be run in serial.

  • What did you expect should have happened?

Expected all specified Lambda triggers to be created in a single deploy.

  • What was the config you used?
functions:
  preSignUp:
    handler: src/handlers.preSignUpHandler
    events:
      - cognitoUserPool:
          pool: ${self:custom.cognitoUserPool}
          trigger: PreSignUp
          existing: true
  defineAuthChallenge:
    handler: src/handlers.defineAuthChallengeHandler
    events:
      - cognitoUserPool:
          pool: ${self:custom.cognitoUserPool}
          trigger: DefineAuthChallenge
          existing: true
  createAuthChallenge:
    handler: src/handlers.createAuthChallengeHandler
    events:
      - cognitoUserPool:
          pool: ${self:custom.cognitoUserPool}
          trigger: CreateAuthChallenge
          existing: true
  verifyAuthChallenge:
    handler: src/handlers.verifyAuthChallengeHandler
    events:
      - cognitoUserPool:
          pool: ${self:custom.cognitoUserPool}
          trigger: VerifyAuthChallengeResponse
          existing: true
  • What stacktrace or error message from your provider did you see?
  Serverless Error ---------------------------------------

  An error occurred: PreSignUpCustomCognitoUserPool1 - Failed to create resource. Only one request to update this UserPool can be processed at a time. See details in CloudWatch Log: 2019/07/20/[$LATEST]71e1d74b910b4766bf1f28e04354fcd1.

  Stack Trace --------------------------------------------

ServerlessError: An error occurred: PreSignUpCustomCognitoUserPool1 - Failed to create resource. Only one request to update this UserPool can be processed at a time. See details in CloudWatch Log: 2019/07/20/[$LATEST]71e1d74b910b4766bf1f28e04354fcd1.
    at provider.request.then.data (/Users/Joel/.nvm/versions/node/v10.4.0/lib/node_modules/serverless/lib/plugins/aws/lib/monitorStack.js:121:33)
From previous event:
    at AwsDeploy.monitorStack (/Users/Joel/.nvm/versions/node/v10.4.0/lib/node_modules/serverless/lib/plugins/aws/lib/monitorStack.js:27:12)
    at provider.request.then.cfData (/Users/Joel/.nvm/versions/node/v10.4.0/lib/node_modules/serverless/lib/plugins/aws/lib/updateStack.js:103:28)
From previous event:
    at AwsDeploy.update (/Users/Joel/.nvm/versions/node/v10.4.0/lib/node_modules/serverless/lib/plugins/aws/lib/updateStack.js:103:8)
From previous event:
    at AwsDeploy.BbPromise.bind.then (/Users/Joel/.nvm/versions/node/v10.4.0/lib/node_modules/serverless/lib/plugins/aws/lib/updateStack.js:117:35)
From previous event:
    at AwsDeploy.updateStack (/Users/Joel/.nvm/versions/node/v10.4.0/lib/node_modules/serverless/lib/plugins/aws/lib/updateStack.js:113:33)
From previous event:
    at AwsDeploy.BbPromise.bind.then (/Users/Joel/.nvm/versions/node/v10.4.0/lib/node_modules/serverless/lib/plugins/aws/deploy/index.js:127:39)
From previous event:
    at Object.aws:deploy:deploy:updateStack [as hook] (/Users/Joel/.nvm/versions/node/v10.4.0/lib/node_modules/serverless/lib/plugins/aws/deploy/index.js:123:30)
    at BbPromise.reduce (/Users/Joel/.nvm/versions/node/v10.4.0/lib/node_modules/serverless/lib/classes/PluginManager.js:464:55)
From previous event:
    at PluginManager.invoke (/Users/Joel/.nvm/versions/node/v10.4.0/lib/node_modules/serverless/lib/classes/PluginManager.js:464:22)
    at PluginManager.spawn (/Users/Joel/.nvm/versions/node/v10.4.0/lib/node_modules/serverless/lib/classes/PluginManager.js:484:17)
    at AwsDeploy.BbPromise.bind.then (/Users/Joel/.nvm/versions/node/v10.4.0/lib/node_modules/serverless/lib/plugins/aws/deploy/index.js:93:48)
From previous event:
    at Object.deploy:deploy [as hook] (/Users/Joel/.nvm/versions/node/v10.4.0/lib/node_modules/serverless/lib/plugins/aws/deploy/index.js:89:30)
    at BbPromise.reduce (/Users/Joel/.nvm/versions/node/v10.4.0/lib/node_modules/serverless/lib/classes/PluginManager.js:464:55)
From previous event:
    at PluginManager.invoke (/Users/Joel/.nvm/versions/node/v10.4.0/lib/node_modules/serverless/lib/classes/PluginManager.js:464:22)
    at PluginManager.run (/Users/Joel/.nvm/versions/node/v10.4.0/lib/node_modules/serverless/lib/classes/PluginManager.js:496:17)
    at variables.populateService.then (/Users/Joel/.nvm/versions/node/v10.4.0/lib/node_modules/serverless/lib/Serverless.js:116:33)
    at runCallback (timers.js:696:18)
    at tryOnImmediate (timers.js:667:5)
    at processImmediate (timers.js:649:5)
    at process.topLevelDomainCallback (domain.js:121:23)
From previous event:
    at Serverless.run (/Users/Joel/.nvm/versions/node/v10.4.0/lib/node_modules/serverless/lib/Serverless.js:103:74)
    at serverless.init.then (/Users/Joel/.nvm/versions/node/v10.4.0/lib/node_modules/serverless/bin/serverless.js:52:28)
    at /Users/Joel/.nvm/versions/node/v10.4.0/lib/node_modules/serverless/node_modules/graceful-fs/graceful-fs.js:111:16
    at /Users/Joel/.nvm/versions/node/v10.4.0/lib/node_modules/serverless/node_modules/graceful-fs/graceful-fs.js:45:10
    at FSReqWrap.oncomplete (fs.js:171:20)
From previous event:
    at initializeErrorReporter.then (/Users/Joel/.nvm/versions/node/v10.4.0/lib/node_modules/serverless/bin/serverless.js:52:6)
    at runCallback (timers.js:696:18)
    at tryOnImmediate (timers.js:667:5)
    at processImmediate (timers.js:649:5)
    at process.topLevelDomainCallback (domain.js:121:23)
From previous event:
    at Object.<anonymous> (/Users/Joel/.nvm/versions/node/v10.4.0/lib/node_modules/serverless/bin/serverless.js:38:39)
    at Module._compile (internal/modules/cjs/loader.js:702:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:713:10)
    at Module.load (internal/modules/cjs/loader.js:612:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:551:12)
    at Function.Module._load (internal/modules/cjs/loader.js:543:3)
    at Function.Module.runMain (internal/modules/cjs/loader.js:744:10)
    at startup (internal/bootstrap/node.js:238:19)
    at bootstrapNodeJSCore (internal/bootstrap/node.js:572:3)

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

  Your Environment Information ---------------------------
     Operating System:          darwin
     Node Version:              10.4.0
     Serverless Version:        1.48.2
     Enterprise Plugin Version: 1.3.1
     Platform SDK Version:      2.0.3

Similar or dependent issues:

Additional Data

  • Serverless Framework Version you're using: 1.48.2
  • Operating System: MacOS High Sierra
  • Stack Trace:
  • Provider Error messages:
@joelvh
Copy link
Contributor Author

joelvh commented Jul 20, 2019

To be clear, it works if I deploy one function at a time, but not all at once in serverless.yml.

@pmuens
Copy link
Contributor

pmuens commented Aug 2, 2019

Hey @joelvh thanks for opening this issue 👍

I just spent some time to look into this and I was able to reproduce the problem. I worked on a fix which can be found in this PR --> #6491

Could you take it for a spin to see if this fixes your problem? You can easily install this branch via npm i -g serverless/serverless#existing-cognit-user-pool-multi (there's a typo in my branch, but I already PRed it 😬).

Thanks in advance!

@joelvh
Copy link
Contributor Author

joelvh commented Aug 6, 2019

@pmuens sorry, didn’t have a chance to test this out since we worked around it. Thanks for fixing!

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

Successfully merging a pull request may close this issue.

3 participants