Skip to content
This repository has been archived by the owner on Feb 5, 2024. It is now read-only.

fix: Change the app name of nodejs-graphql to comply TargetGroup name length limit #132

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

HassenIO
Copy link

@HassenIO HassenIO commented Aug 6, 2023

Context

I cloned the waypoint-examples repo to test out various app deployments with Waypoint. I made no code change to any of the examples.

I correctly initialized waypoint and installed the docker platform with the necessary -accept-tos flag.

Problem

When running waypoint up, I get the following error that stops the process:

 ! Creating TargetGroup for Lambda version
! ValidationError: Target group name 'waypoint-apollo-lambda-function-' cannot
  begin or end with '-'
  	status code: 400, request id: 8a3f2f36-eb22-43af-bca8-6fdc3418b666

I created an issue describing the error in more detail: #131

My investigations on the source code of Waypoint show that we set the service name (aka TargetGroup name) as the app name, concatenated with an id, using the - symbol, as shown here:

https://github.com/hashicorp/waypoint/blob/88abbbc33039d3ba82a49c5c759460c999c8370e/builtin/aws/lambda/platform.go#L547

Then on line 552, we only keep the first 32 characters because that's the limitation set by AWS for TargetGroup names.

That produced my issue because waypoint-apollo-lambda-function- is exactly 32 characters in length.

Solution

  • Reduce the app name length

By changing the app name from waypoint-apollo-lambda-function to waypoint-apollo-lambda-func, I was able to create the TargetGroup waypoint-apollo-lambda-func-01H7, which is 32 characters in length.

This is a reasonable solution because we keep the reference to the lambda function in our app name (using the func keyword) and don't introduce code changes in Waypoint to be more explicit on what's happening.

--

Closes #131

@HassenIO HassenIO requested a review from a team as a code owner August 6, 2023 12:22
@hashicorp-cla
Copy link

hashicorp-cla commented Aug 6, 2023

CLA assistant check
All committers have signed the CLA.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Error on the TargetGroup when creating a lambda for the nodejs-graphql example
2 participants