Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deployment failure: Template format error: Resource name '...' length is greater than 255. #1487

Open
MartinRamm opened this issue Jun 17, 2024 · 2 comments · May be fixed by architect/package#168

Comments

@MartinRamm
Copy link

Describe the issue
During the deployment, having long http endpoint names causes the deployment to fail:

CloudFormation:
image

Template format error: Resource name 'PostApiV1OrganisationsOrganisationIdDashboardsDashboardIdChallengesChallengeIdApprovalsApprovalIndexFeedbackResolvedHTTPLambdaPostApiV1OrganisationsOrganisationIdDashboardsDashboardIdChallengesChallengeIdApprovalsApprovalIndexFeedbackResolvedHTTPEventPermission' length is greater than 255.

image

@http
post /api/v1/organisations/:organisationId/dashboards/:dashboardId/challenges/:challengeId/approvals/:approvalIndex/feedback-resolved
@ryanblock
Copy link
Member

Generally we appreciate and encourage single responsibility functions (over large, monolithic ones), and it seems like you're doing exactly that here – bravo! As an alternative, depending on how much logic you'd need to consolidate, you may want to consider something like post /api/v1/organisations/* to encompass all nested functionality and meet CloudFormation's requirements.

If that won't work for you, I'd encourage you to use deploy.start plugins to overwrite the CloudFormation resource names to be something compliant.

Thoughts?

@MartinRamm
Copy link
Author

MartinRamm commented Jun 18, 2024

Hey Ryan, For now I replaced the parameter names with something shorter so I could deploy. I am not a fan of consolidating the endpoints, but it is an idea I'll keep that in mind for the future.

Looking deeper into this issue, I see that the resource name has the path of the endpoint in twice:

${method}${path}HTTPLambda${method}${path}HTTPEventPermission
=
`PostApiV1OrganisationsOrganisationIdDashboardsDashboardIdChallengesChallengeIdApprovalsApprovalIndexFeedbackResolvedHTTPLambdaPostApiV1OrganisationsOrganisationIdDashboardsDashboardIdChallengesChallengeIdApprovalsApprovalIndexFeedbackResolvedHTTPEventPermission

I know the length of this endpoint is already quite long, but without repeating the path twice it would fit the AWS limit. In my experience, most projects don't need longer endpoints than this. Therefore, my preferred solution would be to not have the path twice in the resource name.

I haven't looked deeply into the deployment code yet, so I have no idea how feasible that is and if it would break existing deployments.

MartinRamm added a commit to MartinRamm/package that referenced this issue Jun 19, 2024
…he lambda name twice

During the deployment, AWS first creates the new resource and the deletes the old one.
Therefore, this fix does not cause any sort of downtime. It should also be backwards
compatible, unless someone relies on the HTTP event name schema while overriding the
cloudformation template in the `deploy.start` hook.

This fixes architect/architect#1487
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants