serverless-appsync-plugin: Unable to get userPoolId from Ref

Currently under userPoolConfig.userPoolId a person must enter a string for the userPool. This is great if your developing just a single AppSync system without stages. However, if using stages, you may have different user pools.

It would be great if the plugin could use

userPoolConfig:
  userPoolId:
    Ref: UserPool

to pull the user pool id from the resources.

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Reactions: 1
  • Comments: 19 (3 by maintainers)

Most upvoted comments

@sid88in I think all is working now. As AppSync now has CloudFormation abilities. I do thank you for the plugin as it had helped me out with getting started doing things in a much easier way on AWS.

I’ll take a look at it over the weekend for sure after I look into the serverless documentation to see how these things work.

@teddarling Maybe something like

provider:
  name: aws
  runtime: nodejs8.10
  stage: ${opt:stage, 'dev'}  ##get stage from cli options, otherwise default stage is dev
custom:
  userPoolId-dev: 123qwe
  userPoolId-production: 456ryt
  accountId: 454227793445 # replace this with your accountId
  appSync:
    name: myApi  
    apiId: asfasdfasdfasdf 
    authenticationType: AMAZON_COGNITO_USER_POOLS
    userPoolConfig: $(self:cutom.userPoolId-$(self:provider.stage))  ##<---OK to nest references