Open gotha opened 6 years ago
hmm are you using the latest version of the plugin? if so, does it stil happens with the previous minor version?
On Fri, Sep 22, 2017, 6:22 AM Hristo Georgiev notifications@github.com wrote:
Hey, I installed the plugin and when I try to deploy I get this:
Serverless: Invoke deploy Serverless: Invoke package Serverless: Invoke aws:common:validate Serverless: Invoke aws:common:cleanupTempDir Serverless: Packaging service... Serverless: Excluding development dependencies... Serverless: Invoke aws:package:finalize Serverless: [serverless-plugin-split-stacks]: Summary: 87 resources migrated in to 3 nested stacks Serverless: [serverless-plugin-split-stacks]: Resources per stack: Serverless: [serverless-plugin-split-stacks]: - (root): 125 Serverless: [serverless-plugin-split-stacks]: - APINestedStack: 24 Serverless: [serverless-plugin-split-stacks]: - PermissionsNestedStack: 31 Serverless: [serverless-plugin-split-stacks]: - VersionsNestedStack: 32 Serverless: Invoke aws:common:moveArtifactsToPackage Serverless: Invoke aws:common:validate Serverless: Merged stage variables into ApiGateway Deployment Serverless: Invoke aws:deploy:deploy Serverless: Uploading CloudFormation file to S3... Serverless: Uploading artifacts... Serverless: Uploading service .zip file to S3 (13.75 MB)... Serverless: Validating template...
Error --------------------------------------------------
The CloudFormation template is invalid: Template format error: Unresolved resource dependencies [ApiGatewayRestApi] in the Resources block of the template
I am using serverless 1.21.1
Any ideas how can I fix this ?
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/dougmoscrop/serverless-plugin-split-stacks/issues/9, or mute the thread https://github.com/notifications/unsubscribe-auth/AAjzFI5KkEhStn4qh3VYDLNKyjVQko6Uks5sk4pogaJpZM4Pgg37 .
@dougmoscrop I tried with 3991fb68017c1616c7b167c43c0720cf62f65b89 and cd6578a9741c6a585822793836301ecba9f31648 getting the same results.
With: 4b14c6d67784bb203fbbb3951fb2cb50ba61c8a2 I see different error:
An error occurred: CoreNestedStack - Embedded stack arn:aws:cloudformation:eu-central-1:xxxx:stack/project-CoreNestedStack-xxx/xxx was not successfully created: The following resource(s) failed to create: [IamRoleLambdaExecution].
I haven't specified IAM Role in the serverless file so I am not really sure where this is coming from.
Hi,
pulled the latest version and I also seem to get the same error (upgraded serverless to latest)
WARNING in ./node_modules/colors/lib/colors.js
127:29-43 Critical dependency: the request of a dependency is an expression
Serverless: Packaging service...
Serverless: Excluding development dependencies...
Serverless: Invoke aws:package:finalize
Serverless: [serverless-plugin-split-stacks]: Summary: 85 resources migrated in to 3 nested stacks
Serverless: [serverless-plugin-split-stacks]: Resources per stack:
Serverless: [serverless-plugin-split-stacks]: - (root): 95
Serverless: [serverless-plugin-split-stacks]: - APINestedStack: 30
Serverless: [serverless-plugin-split-stacks]: - PermissionsNestedStack: 27
Serverless: [serverless-plugin-split-stacks]: - VersionsNestedStack: 28
Serverless: Invoke aws:common:moveArtifactsToPackage
Serverless: Invoke aws:common:validate
Serverless: Invoke aws:deploy:deploy
Serverless: Uploading CloudFormation file to S3...
Serverless: Uploading artifacts...
Serverless: Uploading service .zip file to S3 (4.23 MB)...
Serverless: Validating template...
Error --------------------------------------------------
The CloudFormation template is invalid: Template format error: Unresolved resource dependencies [ApiGatewayRestApi] in the Resources block of the template
For debugging logs, run again after setting the "SLS_DEBUG=*" environment variable.
Stack Trace --------------------------------------------
Error: The CloudFormation template is invalid: Template format error: Unresolved resource dependencies [ApiGatewayRestApi] in the Resources block of the template
at provider.request.catch (C:\Users\Main\AppData\Roaming\npm\node_modules\serverless\lib\plugins\aws\deploy\lib\validateTemplate.js:25:13)
From previous event:
at AwsDeploy.validateTemplate (C:\Users\Main\AppData\Roaming\npm\node_modules\serverless\lib\plugins\aws\deploy\lib\validateTemplate.js:20:12)
From previous event:
at AwsDeploy.BbPromise.bind.then (C:\Users\Main\AppData\Roaming\npm\node_modules\serverless\lib\plugins\aws\deploy\index.js:117:39)
From previous event:
at Object.aws:deploy:deploy:validateTemplate [as hook] (C:\Users\Main\AppData\Roaming\npm\node_modules\serverless\lib\plugins\aws\deploy\index.js:113:10)
at BbPromise.reduce (C:\Users\Main\AppData\Roaming\npm\node_modules\serverless\lib\classes\PluginManager.js:360:55)
From previous event:
at PluginManager.invoke (C:\Users\Main\AppData\Roaming\npm\node_modules\serverless\lib\classes\PluginManager.js:360:22)
at PluginManager.spawn (C:\Users\Main\AppData\Roaming\npm\node_modules\serverless\lib\classes\PluginManager.js:378:17)
at AwsDeploy.BbPromise.bind.then (C:\Users\Main\AppData\Roaming\npm\node_modules\serverless\lib\plugins\aws\deploy\index.js:91:48)
From previous event:
at Object.deploy:deploy [as hook] (C:\Users\Main\AppData\Roaming\npm\node_modules\serverless\lib\plugins\aws\deploy\index.js:87:10)
at BbPromise.reduce (C:\Users\Main\AppData\Roaming\npm\node_modules\serverless\lib\classes\PluginManager.js:360:55)
From previous event:
at PluginManager.invoke (C:\Users\Main\AppData\Roaming\npm\node_modules\serverless\lib\classes\PluginManager.js:360:22)
at PluginManager.run (C:\Users\Main\AppData\Roaming\npm\node_modules\serverless\lib\classes\PluginManager.js:391:17)
at variables.populateService.then (C:\Users\Main\AppData\Roaming\npm\node_modules\serverless\lib\Serverless.js:99:33)
at runCallback (timers.js:672:20)
at tryOnImmediate (timers.js:645:5)
at processImmediate [as _immediateCallback] (timers.js:617:5)
From previous event:
at Serverless.run (C:\Users\Main\AppData\Roaming\npm\node_modules\serverless\lib\Serverless.js:86:74)
at serverless.init.then (C:\Users\Main\AppData\Roaming\npm\node_modules\serverless\bin\serverless:39:50)
Get Support --------------------------------------------
Docs: docs.serverless.com
Bugs: github.com/serverless/serverless/issues
Forums: forum.serverless.com
Chat: gitter.im/serverless/serverless
Your Environment Information -----------------------------
OS: win32
Node Version: 6.10.3
Serverless Version: 1.23.0
I'm getting this same error message. Was there any fix or workaround?
Followup: Any chance it's an interaction with the serverless-aws-documentation plugin?
Stuck on this bug ... any info on this? I'm using v1.3.1 of this plugin ... and I'm using the serverless-aws-documentation plugin, I'll try to hunt this down from the outside.
any chance you could share your CF json?
also does this happen when you deploy a fresh stage? there are certain configs of CF that simply can't be 'upgraded' from not using this plugin to using this plugin (you have to tear down / set up a new deployment)
Yes, for sure ...
Post-Nested Stacks.zip Prior to Nested Stacks.zip
Couple of caveats: 1) This is a fresh stage. I am completely in agreement with you ... in fact the project we're working on is migrating a pre-existing stage into multiple stages, and so we've become well-versed on the limits of changing pre-existing stages. I think that's not the issue here. 2) This isn't a vanilla test at this moment ... because I added some breakdowns above and beyond your default breakdowns. Primarily I'm using your plugin because DynamoDb autoscaling is such a resource hog. I can revert to a vanilla test for you later today, just to rule out any of my changes from the issue ... but based on the deterministic quality of this issue, I suspect it's less dependent upon my changes.
I'm looking to, but up to now I don't see a problem - everything seems correct re: references to the output ApiGatewayRestApi, outputting it from one stack, uses in the others ... I'm sure you'll be able to see the issue faster than me.
Here's the vanilla post-test: Vanilla Post-Nested Stacks.zip
Same error message as before ... but now you can rule out any changes I made to stacks-map.js. Serverless plugins I'm using are:
I'm going to keep on debugging over here, let you know if I see anything.
It's definitely something to do with the serverless-aws-documentation plugin. When I remove that from my plugins, then split-stacks works without errors.
I think this in stacks-map.js:
// These two deletions are to solve a conflict caused with serverless-aws-documentation:
// https://github.com/9cookies/serverless-aws-documentation/issues/62
// https://github.com/dougmoscrop/serverless-plugin-split-stacks/issues/9
delete stacksMap['AWS::ApiGateway::Resource'];
delete stacksMap['AWS::ApiGateway::RestApi'];
May help. https://github.com/9cookies/serverless-aws-documentation/issues/62
I'm hitting another problem with the autoscaler, so I can't confirm it's all smooth sailing ... I'm also thinking there is a more refined solution, but I can handle the API resources being in the main resource file for now.
Is there any update with this issue?
Sorry for not being more responsive.
The documentation plugin is injecting resources during the deploy phase. I don't see why it needs to, or why you would want that. I would expect it to hook in to package.
So yes there is at least one problem here, which is that the documentation plugin should move their resource injection to the package phase.
@cdichiara - when you say problems with auto scale, do you mean to say that it's related to split-stacks? Or just that it's not working the way you want?
@dougmoscrop Can you give me some guidance how to move documentation plugin's resource injection to package phase? So i can raise a PR to their repo?
Thanks in advance.
I would try:
https://github.com/9cookies/serverless-aws-documentation/blob/master/src/index.js#L22
Just make the first one before:package:package
@dougmoscrop Hey I don't think there's a before:package:package
event in serverless lifecycle.
https://gist.github.com/HyperBrain/50d38027a8f57778d5b0f135d80ea406
Yeah, sorry - I mean something in that area. I haven't kept up on what they changed the names to!
try before:package:finalize
but I think anything that is before this plugin is fine.
@dougmoscrop Thank you for the help. It works like charm!
@dougmoscrop Thanks for responding ... honestly I've forgotten what I was thinking back then. If I recall, I think serverless-dynamodb-autoscaling was producing quite a lot of resources per scaled database (extra IAM roles, along with the necessary alarms, etc) ... but I thought there was some other issue that made it fail when I attempted to move the resources to a substack with your stack splitter. Anyways, I "solved" it by commenting out parts of the deployment, deploying, uncommenting out parts, deploying, etc. until the full deployment was up, and now since everything is a delta on the big deployment, we're "OK". Thanks for asking. 😄
Okay, great - I am going to close this, but @gotha and/or @dbligh if you still experience please open. You did not explicitly say that you were using the documentation plugin, so it could be some other plugin you are using that is inserting a resource after the package phase.
Hi @dougmoscrop I'm running into the same issue and not using the documentation plugin these are the plugins used
Serverless: Invoke aws:package:finalize
Serverless: [serverless-plugin-split-stacks]: Summary: 65 resources migrated in to 3 nested stacks
Serverless: [serverless-plugin-split-stacks]: Resources per stack:
Serverless: [serverless-plugin-split-stacks]: - (root): 134
Serverless: [serverless-plugin-split-stacks]: - APINestedStack: 58
Serverless: [serverless-plugin-split-stacks]: - PermissionsNestedStack: 6
Serverless: [serverless-plugin-split-stacks]: - VersionsNestedStack: 1
Serverless: Invoke aws:common:moveArtifactsToPackage
Serverless: Invoke aws:common:validate
Serverless: Commencing API Gateway stage configuration
Serverless: API Gateway stage configuration complete
Serverless: Invoke aws:deploy:deploy
Serverless: Uploading CloudFormation file to S3...
Serverless: Uploading artifacts...
Serverless: Uploading service .zip file to S3 (59.54 MB)...
Serverless: Validating template...
Error --------------------------------------------------
The CloudFormation template is invalid: Template format error: Unresolved resource dependencies [ApiGatewayRestApi] in the Resources block of the template
Well that was quick!
And just as quick: https://github.com/leftclickben/serverless-api-stage/blob/master/src/index.js#L7
It is injecting resources in deploy phase.
@dougmoscrop thanks for the help. We resolved this by forking that plugin and changing that line to 'before:package:finalize'
:
https://github.com/headnote/serverless-api-stage
We did run into another issue with your latest version (1.4.0) though, issue here: https://github.com/dougmoscrop/serverless-plugin-split-stacks/issues/27
1.3.2 is working fine 👍
I dont know if I should revive this thread, also, dont know if I should post the issue under the split-stacks or documentation plugin but you've been really helpful (thanks!).
I think I have found another bug between the plugins since I was able to deploy our serverless project before adding the split-stacks. It really is not much of a big deal since I found a workaround (took me some time to finally nail down the problem). I posted the issue under the PR fix for the documentation plugin.
https://github.com/9cookies/serverless-aws-documentation/pull/69#issuecomment-365316088
I am seeing the same issue:
plugins:
Serverless: Excluding development dependencies... Serverless: [serverless-plugin-split-stacks]: Summary: 78 resources migrated in to 3 nested stacks Serverless: [serverless-plugin-split-stacks]: Resources per stack: Serverless: [serverless-plugin-split-stacks]: - (root): 117 Serverless: [serverless-plugin-split-stacks]: - APINestedStack: 22 Serverless: [serverless-plugin-split-stacks]: - PermissionsNestedStack: 28 Serverless: [serverless-plugin-split-stacks]: - VersionsNestedStack: 28 Serverless: Uploading CloudFormation file to S3... Serverless: Uploading artifacts... Serverless: Validating template... Serverless: Updating Stack... Serverless: Checking Stack update progress... ............................................................................................................................................................................................. Serverless: Operation failed!
Serverless Error ---------------------------------------
An error occurred: VersionsNestedStack - Embedded stack [...] was not successfully created: The following resource(s) failed to create: ...
Any idea how I can address this?
+1, have this issue when also using serverless-aws-documentation. Commenting it out temporarily fixed that error, but then also I still can't deploy with a different error...
An error occurred: ApiGatewayDeployment1528719760739 - No integration defined for method (Service: AmazonApiGateway; Status Code: 400; Error Code: BadRequestException; Request ID: 5b41d40d-6d72-11e8-8c64-13bb0bc179fe).
Using
- serverless-plugin-split-stacks
- serverless-domain-manager
getting the same error
The CloudFormation template is invalid: Template format error: Unresolved resource dependencies [ApiGatewayRestApi] in the Resources block of the template
Which plugin is doing something bad here?
Reference: https://github.com/amplify-education/serverless-domain-manager/issues/120
If anyone else runs into this error there is a simple fix:
Add a stacks-map.js
to your serverless root directory with the following content:
/*
DANGER!
Using this file incorrectly can delete resources
*/
module.exports = {
'AWS::ApiGateway::Resource': false,
'AWS::ApiGateway::RestApi': false,
};
This way the ApiGatewayRestApi is not moved into a nested stack and can still be accessed by serverless-domain-manager
and related
This is only an issue if using perType
strategy. Disabling it explicitly in favour of perFunction
works perfectly fine:
splitStacks:
perFunction: true
perType: false
I know this might not be an option if you manage foundational infra using cfn on sls. In our case this is not an issue because we manage foundational infra using terraform.
@dougmoscrop I was confused at first because the readme says perFunction takes precedence over perType. You might want to highlight perType still applies to other resources.
Yep I can see how that would be confusing
I just ran into this issue and thought it might be worth detailing why it happened here in case it helps anyone else. In my case I am trying to split a fairly large existing stack with a lot of custom resources and plugins (a couple of which depend on the ApiGatewayRestApi resource) which cannot be replaced (such as Cognito user pools, the replacement of which results in unrecoverable data loss) so I've gone down the perFunction
route.
Because I have a lot of existing functions and can't see a way to get existing resources related to those functions into the nested stacks, I temporarily removed all of the functions from serverless.yml
, and added a single new function as a placeholder, with the intention of subsequently removing that function and putting the original ones back in. Deploying the stack at this point resulted in the error discussed in this issue.
The cause in my case was the fact that my placeholder function did not have an http
event in its definition, which understandably means the Serverless Framework does not need to create an ApiGatewayRestApi resource. I resolved the issue by providing an http
event to the function so that the resource was created as before.
I just ran into this issue and thought it might be worth detailing why it happened here in case it helps anyone else. In my case I am trying to split a fairly large existing stack with a lot of custom resources and plugins (a couple of which depend on the ApiGatewayRestApi resource) which cannot be replaced (such as Cognito user pools, the replacement of which results in unrecoverable data loss) so I've gone down the
perFunction
route.Because I have a lot of existing functions and can't see a way to get existing resources related to those functions into the nested stacks, I temporarily removed all of the functions from
serverless.yml
, and added a single new function as a placeholder, with the intention of subsequently removing that function and putting the original ones back in. Deploying the stack at this point resulted in the error discussed in this issue.The cause in my case was the fact that my placeholder function did not have an
http
event in its definition, which understandably means the Serverless Framework does not need to create an ApiGatewayRestApi resource. I resolved the issue by providing anhttp
event to the function so that the resource was created as before.
That helped me a lot. In a few words:
I was tryng to deploy an empty stack with no functions. So I added a demo function and it worked!
Hi @dougmoscrop, I am using the following plugins:
along with the split stacks plugin and suddenly from the last couple of days, I am getting this error - Error: The CloudFormation template is invalid: Template format error: Unresolved resource dependencies [ApiGatewayRestApi]
Update - The deployments are only failing for the latest version, downgrading to V1.9.3 is working fine
Hi @dougmoscrop good day! I'm using the latest version of the plugin but getting the same error. I've been stuck for 3 weeks now. Any help would be greatly appreciated since production server is getting affected now. Here is the actual scenario: I've a root production stack which has around 1400 resources, it worked until 28th of March this year and then after that it stopped working by throwing an error: Circular dependency. . at that point, I stopped deploying that stack. also I took the last good version of my project but still getting the same error :( As ar result, I tried to deploy to a new stack, and here i'm getting this error: "Unresolved resource dependencies...." any help possible?
Are you saying that this started with the latest version of this library? Have you tried locking to a previous version?
Hello, @dougmoscrop - Thanks a lot for your quick reply. actually yes, I locked with a previous version, but since still was getting circular dependency error, I upgraded to latest version and then many time it worked. suddenly it isn't!
Does your stack .json contain sensitive information, or can you share it? Can you share details about the full error message?
hello @dougmoscrop Dough - sorry for being late response. Actually i was trying something and I managed to get rid of that error but now i'm getting a new error which is "Error: Missing required key 'restApiId' in params". Could you help please? Basically if possible, could you share your email which you monitor regularly so that we can have a back and forth in email? or your skype?
Hi @dougmoscrop - i'm again getting the error: Unresolved resource dependencies . Could you please get back to me?
hello @dougmoscrop - need help please, i'm stuck from 3 weeks as of now and please let me know what files I need to share...
I can't provide the level of support you want, but the error message should tell you what resources are involved. Then you look at the .JSON files in the .serverless directory
Further, there has to be some new resources you're adding or changed config which prevents you from deploying - something changed since you last deployed. I would undo that change, and then start looking at deploying a second entire app that reuses resources from the first stack
Post the error message
Hi @dougmoscrop - Thanks for your reply! I've tried to deploy as you said. the last good code to a new stack. Following are the errors now: × Stack reqfast-api-v2-sls3-1-prod failed to deploy (534s) Environment: win32, node 18.19.1, framework 3.38.0 (local), plugin 7.2.3, SDK 4.5.1 Credentials: Local, "reqfast" profile Docs: docs.serverless.com Support: forum.serverless.com Bugs: github.com/serverless/serverless/issues
Error: CREATE_FAILED: UsersPostModel (AWS::ApiGateway::Model) Resource handler returned message: "Too Many Requests (Service: ApiGateway, Status Code: 429, Request ID: 35806ff6-8468-4ea8-818c-c2a1af984a81)" (RequestToken: ca67e546-d44d-0ba6-b02c-284f0192f4a0, HandlerErrorCode: InternalFailure)
You're being rate limited by the AWS API Gateway APIs.
You can try this https://github.com/dougmoscrop/serverless-plugin-split-stacks?tab=readme-ov-file#concurrency but I didn't write that feature. You might want lower numbers of concurrency too
I would use http proxy not rest APIs.
@dougmoscrop - let me try stackConcurrency: 5 # Controls if enabled and how much stacks are deployed in parallel. Disabled if absent. resourceConcurrency: 10 # Controls how much resources are deployed in parallel. Disabled if absent.
and also - http proxy you mean the single function implementation?
Yes
Ohh that won't be possible in this case. the stakeholders don't want that
@dougmoscrop - now getting this error: **× Stack reqfast-api-v2-sls3-1-prod failed to deploy (342s) Environment: win32, node 18.19.1, framework 3.38.0 (local), plugin 7.2.3, SDK 4.5.1 Credentials: Local, "reqfast" profile Docs: docs.serverless.com Support: forum.serverless.com Bugs: github.com/serverless/serverless/issues
Error: The CloudFormation template is invalid: Circular dependency between resources: [10NestedStack, 17NestedStack, 20NestedStack, ApiGatewayDeployment1713218042990, 1NestedStack, 16NestedStack, 11NestedStack, 18NestedStack, 6NestedStack, 8NestedStack, 5NestedStack, 14NestedStack, 3NestedStack]**
Hey, I installed the plugin and when I try to deploy I get this:
I am using serverless 1.21.1
Any ideas how can I fix this ?