question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

how does dependsOn work in backend-config.json

See original GitHub issue

I’m struggling to get dependsOn in backend-config.json to do anything useful.

Which Category is your question related to? deploying

Amplify CLI Version

$ amplify -v
4.29.2

What AWS Services are you utilizing? many - AppSync, Functions, and custom cloudformation.

Provide additional details e.g. code snippets

My backend-config.json includes:

  "security": {
    "l12n": {
      "providerPlugin": "awscloudformation"
    }
  },
  "function": {
    "l12nAPI": {
      "build": true,
      "providerPlugin": "awscloudformation",
      "service": "Lambda",
      "dependsOn": [
        {"category": "security", "resourceName": "l12n", "attributes": ["SecurityGroupId"]}
      ]
    }
  },

where security/l12n is just a folder structure to hold a custom cloudformation template that simply creates a SecurityGroup for the function to run in a VPC.

From what I’ve seen in other posts, I think dependsOn can be used to force the deployment order. I have several stacks that need a specific order and in all of them I tried a scheme like I’m showing here. When I use this strategy, I get cloudformation errors that read like:

UPDATE_FAILED functionl12nAPI AWS::CloudFormation::Stack Thu Sep 24 2020 08:21:28 GMT-0700 (Pacific Daylight Time) Parameters: [securityl12nSecurityGroupId] do not exist in the template

The function stack takes a parameter called SecurityGroupId, which is specified in the file function/l12nAPI/parameters.json as:

{
  "SecurityGroupId": {
    "Fn::GetAtt": [
        "securityl12n",
        "Outputs.SecurityGroupId"
    ]
  }
}

The parameters.json is sufficient to get the stack to deploy. It seems that adding dependsOn corrupts the name of the parameter being passed to the CF template.

It would be great if you could describe how I’m supposed to use dependsOn or point me to the documentation. Thank you!

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
cyrfercommented, Aug 3, 2021

Yes, much clearer, actual documentation on the schema allowed.

0reactions
josefaidtcommented, Jun 22, 2022

Closing in favor of tracking #10043 for providing JSON schemas with descriptions of properties and their usage

Read more comments on GitHub >

github_iconTop Results From Across the Web

DependsOn attribute - AWS CloudFormation
When you add a DependsOn attribute to a resource, that resource is created only after the creation of the resource specified in the...
Read more >
AWS Amplify List Resource Dependencies - Stack Overflow
This is an example of auth category looks like in amplify/backend/backend-config.json file with an AWS lambda function/custom message ...
Read more >
How to pass the Amplify app ID to a function? How to do app ...
I've spent days trying to figure this out, and I have at least learned the secret, undocumented way to use dependsOn in the...
Read more >
Extend AWS Amplify with Custom Resources - Cevo
AWS Amplify is an opinionated full stack serverless framework and set of ... and add them in the dependsOn array in our backend-config.json....
Read more >
Implementing SQS Queue with lambda in AWS Amplify using ...
In this tutorial, we are integrating SQS to send message in to lambda ... the order in which resources will be created on...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found