Closed rts-rob closed 3 years ago
Internal ticket number is LABS-19
@rts-rob this is because functions created before roles https://github.com/fauna-labs/serverless-fauna/blob/main/fauna/DeployQueries.js#L18. Another case is that role might have privileges to call function. and in this case, a function must be created first.
Right - that is the cause and I linked it above. However, that isn't a great experience for the developer.
Expected behavior would be to define a valid configuration and deploy it in a single sls fauna deploy
command. One way to do this is to build a DAG of dependencies and create each resource one by one, rather than by category.
The plugin throws an error when an "earlier" resource depends on a "later" resource. Ordering is:
This means a user cannot create a UDF and a custom role in a single deployment.
Steps to recreate
provider: name: aws runtime: go1.x lambdaHashingVersion: 20201221
plugins:
fauna: client: secret: ${env:FAUNA_SECRET}
functions: always-true: name: always_true body: Lambda([], true) role: ${self:fauna.roles.true-function-role.name}
roles: true-function-role: name: true_function privileges: []
Serverless: Running "serverless" installed locally (in service node_modules) Fauna: Schema updating in process... Fauna: Error: upsert.function.always_true =>
let,2,res,else,role
: Cannot read reference.