serverless-domain-manager: Error: Failed to find CloudFormation resources for
Community Note
- Please vote on this issue by adding a š reaction to the original issue to help the community and maintainers prioritize this request
- Please do not leave ā+1ā or āme tooā comments, they generate extra noise for issue followers and do not help prioritize the request
- If you are interested in working on this issue or have submitted a pull request, please leave a comment
Bug Report
Error Description
I ran into the resource limit 200 problem with serverless. For that I used the serverless-nested-stack
and it worked. I now want to use the serverless-domain-manage
to have a sub domain for my services.
Command Run
I ran sls create_domain
and then sls deploy
Console Output `Error --------------------------------------------------
Error: Failed to find CloudFormation resources for <mydomain>`
Domain Manager Configuration
Replace this with your own serverless.yml
file (anonymized, of course) to help us better resolve your issue.
custom:
customDomain:
domainName: ${self:provider.api_endpoint}
certificateName: ${self:provider.certificate}
basePath: ''
stage: ${self:provider.stage}
createRoute53Record: true
Versions
- Domain Manager version(s): ^3.1.0
- Node runtime: nodejs8.10
- Serverless Version: v1.38.0
- Lambda Code Javascript
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Reactions: 102
- Comments: 56 (2 by maintainers)
Got the same issue today, have three microservices, on two of them the configuration works as it should. But the third also throws āFailed to find CloudFormation resources forā. They were deloyed on a fresh account, where the domain manager was not used before.
EDIT
Problem was with the user, not the pluginā¦ Did not add a http event to my lambda function, so no API Gateway was created.
Before:
After:
I ran into this same issue, but was able to fix it by changing the
httpApi
event key in myserverless.yaml
tohttp
. Is this perhaps a documentation issue or undocumented breaking change?Before (same error mentioned here; calling the Lambda directly works, but calling through the custom domain returns āforbiddenā):
After (no error, successful deployment):
Encase anyone else runs into this I had to specify the
AWS_REGION
environment variable. Previously I never had to provide this for a successful deployment. e.g.AWS_REGION=us-east-1
@allanitis I havenāt made the PR to the project (lots of works - just published it to my own private registry) but not sure if is getting enough attention at the moment. I see lots of PRs open without any comment. Iāll submit the PR tomorrow so you can take a look to it (also Iāll upload a fork on my acc)
The combination of versions has nothing to do with serverless-plugin-split-stacks problem. @captainsidd already said what is the problem in code. I have the code working on my local env, will make a PR later today
The correct explanation to this problem is that serverless-plugin-split-stacks does not create a cloudformation resource called ApiGatewayRestApi in the stack. Instead it creates APINestedStack (which is a stack). In order to apply the mappings, domain-manager needs to get StackName of APINestedStack and do another DescribeStackResource to that stackName with ApiGatewayRestApi resource and get the PhysicalResourceId of it to apply the mappings
š This was also broken for me. Downgrading to 2.3.5 worked.
@angel-carvajal Thanks for your fix! I am installing all plugins the regular way and your plugin afterward as follows (I am using regular API Gateway):
npm install --save-dev @types/node@12
npm install --save-dev "angel-carvajal/serverless-domain-manager#v1.0.0"
Just to possibly help someone out here, we actually encountered this error in the logs of our CI, but it turns out it was a simple configuration error in a new service on our part.
if you turn on
env SLS_DEBUG=*
you may also see more info like this one:ValidationError: 1 validation error detected: Value 'auth-[object Object]' at 'stackName' failed to satisfy constraint: Member must satisfy regular expression pattern: [a-zA-Z][-a-zA-Z0-9]*|arn:[-a-zA-Z0-9:/._+]*
In our case
'auth-[object Object]'
was supposed to be'auth-dev'
and this was actually caused bystage: {self:provider.stage}
needing to bestage: ${self:provider.stage}
(missing $ for the var)Error: Unable to fetch information about [domain]
was actually coming from the stack failing to create because the name failed to resolve correctly.Ran into this but just had to specify the API TYPE to be able to use httpApi instead. The default is rest which is the - http V1
API Gateway v2 HTTP API API Gateway v1 REST API
Any news?
If Iām not misunderstanding something or you are omitting something from the quoted configurationā¦ then:
Your SQS lambda does not create any aws gateway resources which could be connected with the domain api.mywebsite.com. I think the way itās supposed to go is that you need to create a http (or websocket or something) endpoint which is connected to API gateway and this endpoint would then talk to the SQS, in order for it to have API GW resources which would get assigned a domain name.
I had a bit of a similar issue when developing one of my split-stack services. (All use the same serverless.yml, with just different functions-section). Other services create restful http apis, but one particular stack only creates scheduled lambdas for bookkeeping, i.e. These lambdas (like your SQS handler) donāt create anything that would be exposed via API gateway.
When I started writing these I didnāt add a http endpoint, and got the exact same error, which went away after adding the http endpoint which would actually be exposed with the DNS name.
@stefanhorning this is the comment Iām talking about. Provide that info and Iāll fix your scenario
I just merged the solution I had working before into my clone https://github.com/angel-carvajal/serverless-domain-manager in case someone needs it now
NOTES:
perFunction
split stack (TODO: Manual test on perType and perGroupFunction)add the dependency on your package-lock pointing to my clone and that should be it (I added a postinstall script that npm run build so you have the dist folder of it - I created a tag v1.0.0 in case you want to pull a tag instead of master)
Latest
serverless@1.67.0
andserverless-domain-manager@3.3.1
seems to be solving the problem.serverless@1.61.1 serverless-domain-manager@2.3.5 serverless-plugin-split-stacks@1.9.3
This combination worked for us.
Getting this on
sls deploy
for the recent serverless versions ā i.e. for version1.61.2
and above. Error doesnāt appear if I downgrade the framework to1.61.1
. Plugin version:serverless-domain-manager@3.3.0
@diegomarzo , this workaround worked for me, thanks!
Went into cloudformation, deleted the stacks manually, redeployed and it worked. I think my coworker initially deployed it missing a file, then redeployed and it failed.
Note Iām using https://github.com/dougmoscrop/serverless-plugin-split-stacks
@vcelisBP please update the plugin to version 5.0.0.
Hello everyone,
I have the same issue. Iām trying te deploy a single lambda with a sqs event. This is where it doesnāt work. When I switch it to a http event. It worksā¦
Always the same error : Error: Error: Failed to find CloudFormation resources for api.mywebsite.com
When I SLS_DEBUG it, I have this: ValidationError: Resource ApiGatewayRestApi does not exist for stack service-name-prod
Have you got any ideas ?
Actually that was a permissions issue with my IAM user, afer allowing all apigateway actions (without IAM conditions) I now get a different error
Error: Error: Unable to setup base domain mappings for <domain>
. Which is proably a different bug/issue.Sill running into this with
serverless: 1.72.0
andserverless-domain-manager: 3.3.2
. However I am using the http-api product of API GW (httpApi
in serverles.yml).Using āangel-carvajal/serverless-domain-manager#v1.0.0ā, or upgrading to 4.1.1 didnāt seem to help for me.
(I am not using serverless-plugin-split-stack)
Can confirm this worked for me. Muchas muchas gracias!
In
package.json
, change to"serverless-domain-manager": "angel-carvajal/serverless-domain-manager#v1.0.0"
Am using serverless@1.71.0 and serverless-plugin-split-stacks@1.9.3
I am having the same issue after updating. Exporting
AWS_REGION
did not fix the problem for me.Downgrade not work for me, iām using serverless-plugin-split-stacks. Any update for this issue?
Any development on this? Having the same issue with the latest version also getting the same error with older version 3.1.x