Template format error: Unresolved resource dependencies [ApiGatewayResourceAppAnyVar]

I have an existing project that I made some minor text edits to and then deployed and it errors with the message below.

My edits were purely to text/html, not actual code or anything to do with serverless.

This was with sls version 2.18.0. The last successful build was with 2.16.1 (3 weeks ago) so I tried that and got the same error.

If I go look at the actual compiled-cloudformation-template.json file I do see ApiGatewayResourceAppAnyVar used in a few places. I also checked one of the successful builds and it is in there too.

If I google ApiGatewayResourceAppAnyVar I get nothing. I don’t see anything in the serverless change log that references it either.

Any ideas of what I can do?

Error --------------------------------------------------

Error: The CloudFormation template is invalid: Template format error: Unresolved resource dependencies [ApiGatewayResourceAppAnyVar] in the Resources block of the template
at /usr/local/lib/node_modules/serverless/lib/plugins/aws/deploy/lib/validateTemplate.js:20:13
From previous event:
at AwsDeploy.validateTemplate (/usr/local/lib/node_modules/serverless/lib/plugins/aws/deploy/lib/validateTemplate.js:16:85)
From previous event:
at AwsDeploy. (/usr/local/lib/node_modules/serverless/lib/plugins/aws/deploy/index.js:117:39)
From previous event:
at Object.aws:deploy:deploy:validateTemplate [as hook] (/usr/local/lib/node_modules/serverless/lib/plugins/aws/deploy/index.js:113:30)
at /usr/local/lib/node_modules/serverless/lib/classes/PluginManager.js:518:55
From previous event:
at PluginManager.invoke (/usr/local/lib/node_modules/serverless/lib/classes/PluginManager.js:518:22)
at PluginManager.spawn (/usr/local/lib/node_modules/serverless/lib/classes/PluginManager.js:538:17)
at AwsDeploy. (/usr/local/lib/node_modules/serverless/lib/plugins/aws/deploy/index.js:93:48)
From previous event:
at Object.deploy:deploy [as hook] (/usr/local/lib/node_modules/serverless/lib/plugins/aws/deploy/index.js:89:30)
at /usr/local/lib/node_modules/serverless/lib/classes/PluginManager.js:518:55
From previous event:
at PluginManager.invoke (/usr/local/lib/node_modules/serverless/lib/classes/PluginManager.js:518:22)
at /usr/local/lib/node_modules/serverless/lib/classes/PluginManager.js:553:24
From previous event:
at PluginManager.run (/usr/local/lib/node_modules/serverless/lib/classes/PluginManager.js:553:8)
at /usr/local/lib/node_modules/serverless/lib/Serverless.js:203:33
at processImmediate (internal/timers.js:456:21)
at process.topLevelDomainCallback (domain.js:137:15)
From previous event:
at Serverless.run (/usr/local/lib/node_modules/serverless/lib/Serverless.js:190:74)
at /usr/local/lib/node_modules/serverless/scripts/serverless.js:50:26

Your Environment Information ---------------------------
Operating System: linux
Node Version: 12.16.1
Framework Version: 2.18.0
Plugin Version: 4.4.2
SDK Version: 2.3.2
Components Version: 3.4.6

if I look in the cloudformation template for the error it looks like this may have to do with the 200 limit on the number of functions you can have. We use a plugin -serverless-plugin-split-stacks to split them up to get past the limit.

difference in the 2 templates:
with the error - current:
“ResourceId”:{“Ref”:“ApiGatewayResourceAppAnyVar”}

old when it worked:
“ResourceId”:{“Fn::GetAtt”:[“APINestedStack”,“Outputs.ApiGatewayResourceAppAnyVar”]}

that was it, the plugin is currently in a failed state and we were pulling in the latest version.
I pinned it in the package.json to be:

“serverless-plugin-split-stacks”: “1.9.3”

and now the build succeeds.

We were only just over the 200 limit, like 210 or something, so now need to figure out how to remove this dependency.

2 Likes

I was passing for the same problem here, fixed installing serverless-plugin 1.9.3 as you mentioned. Tks a lot.