This repository was archived by the owner on May 1, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6
This repository was archived by the owner on May 1, 2020. It is now read-only.
Support for nested state reference #13
Copy link
Copy link
Open
Labels
questionFurther information is requestedFurther information is requested
Description
Currently it appears to not be possible to reference a nested state object inside the serverless.yml
file.
serverless.yml:
cognitoUserPool:
component: '@serverless/aws-cognito'
inputs:
region: us-east-1
authTemplate: COGNITO_USER_POOL
myAppSyncApi:
component: "@serverless/aws-app-sync"
inputs:
name: appApi
# Amazon Cognito Authentication
authenticationType: AMAZON_COGNITO_USER_POOLS
userPoolConfig:
awsRegion: us-east-1
defaultAction: ALLOW
userPoolId: ${cognitoUserPool.app.poolId}
state file (Template.cognitoUserPool.json):
{
"app": {
"poolId": "us-east-1sxxxxxxx",
"poolArn": "xxxxxxxxxxxxx",
"clientId": "xxxxxxxxxxxxxxx"
},
"region": "us-east-1"
}
Error:
error:
Error: invalid reference ${cognitoUserPool.app.poolId}
at Object.<anonymous> (/usr/local/lib/node_modules/serverless/node_modules/@serverless/template/utils.js:59:17)
at walker (/usr/local/lib/node_modules/serverless/node_modules/traverse/index.js:190:22)
at /usr/local/lib/node_modules/serverless/node_modules/traverse/index.js:208:29
at Array.forEach (<anonymous>)
at forEach (/usr/local/lib/node_modules/serverless/node_modules/traverse/index.js:298:31)
at walker (/usr/local/lib/node_modules/serverless/node_modules/traverse/index.js:203:13)
at /usr/local/lib/node_modules/serverless/node_modules/traverse/index.js:208:29
at Array.forEach (<anonymous>)
at forEach (/usr/local/lib/node_modules/serverless/node_modules/traverse/index.js:298:31)
at walker (/usr/local/lib/node_modules/serverless/node_modules/traverse/index.js:203:13)
4s › usersLambda › Error: invalid reference ${cognitoUserPool.app.poolId}
Why would you want to do this?
When creating Serverless Components, you need to save state (e.g. this.save()
) and it's much easier to logically group things together (by a key) than to have it all be flat inside the Template.cognitoUserPool.json
object.
Metadata
Metadata
Assignees
Labels
questionFurther information is requestedFurther information is requested