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

Error on the TargetGroup when creating a lambda for the nodejs-graphql example #131

Open
HassenIO opened this issue Aug 5, 2023 · 1 comment · May be fixed by #132
Open

Error on the TargetGroup when creating a lambda for the nodejs-graphql example #131

HassenIO opened this issue Aug 5, 2023 · 1 comment · May be fixed by #132
Labels

Comments

@HassenIO
Copy link

HassenIO commented Aug 5, 2023

Describe your environment

I'm getting issue running the waypoint-examples/aws/lambda/nodejs-graphql example as is (with no change to the provided scripts).

  • OS: MacOSX Ventura 13.4.1 darwin/arm64 (M1)
  • Waypoint version:
    • CLI: v0.11.3 (2933d41)
    • Server: v0.11.3
  • Docker version: 24.0.5

Describe the bug

Running waypoint up produces an error on the TargetGroup for Lambda:

 ! 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

Steps to Reproduce

As described in the tutorials, I ran the initialization commands as follow:

waypoint install -platform=docker -accept-tos
waypoint init

which both went successful.

The waypoint.hcl file is the same as in the example https://github.com/hashicorp/waypoint-examples/blob/main/aws/lambda/nodejs-graphql/waypoint.hcl

However, running waypoint up produces the following outputs:

waypoint up

» Performing operation locally

» Building waypoint-apollo-lambda-function...
 + Running build v3
 + All services available.
 + Set ECR Repository name to 'waypoint-apollo-lambda'
 + Creating new repository: waypoint-apollo-lambda
 + Initializing Docker client...
 + Building image...
 + Injecting Waypoint Entrypoint...
Image built: waypoint.local/waypoint-apollo-lambda-function:latest (amd64)
 + Running push build v3
 + All services available.
 + Set ECR Repository name to 'waypoint-apollo-lambda'
 + Tagging Docker image: waypoint.local/waypoint-apollo-lambda-function:latest =>
1234567890.dkr.ecr.us-east-1.amazonaws.com/waypoint-apollo-lambda:da5c2acb0997f8390469bdce5a3dece9684a1822
 + Pushing Docker image...
 │ d1f898c70255: Pushed
 │ 5f70bf18a086: Pushed
 │ 12048eda2ea5: Pushed
 │ 3e5afe3675f2: Pushed
 │ 15dd6c63f3a2: Pushed
 │ c265a0dbdf5a: Pushed
 │ f6999ba7b1dc: Pushed
 │ 2a9a5b39a041: Pushed
 │ da5c2acb0997f8390469bdce5a3dece9684a1822: digest: sha256:011901660281317186e40bb
 │ e07a2c5fcf798b893bf906d46a3f8156a13ea01e8 size: 2210
 + Docker image pushed: 1234567890.dkr.ecr.us-east-1.amazonaws.com/waypoint-apollo-lambda:da5c2acb0997f8390469bdce5a3dece9684a1822

» Deploying waypoint-apollo-lambda-function...
 + Running deploy v3
 + Connecting to AWS
 + Updated Lambda configuration.
 + Updated function code!
 + Published Lambda function: arn:aws:lambda:us-east-1:1234567890:function:waypoint-apollo-lambda-function:3 (3)
 ! 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

Expected behavior

It should successfully deploy the NodeJS + Graphql application.

Additional context

None.

@HassenIO HassenIO added the new label Aug 5, 2023
@HassenIO
Copy link
Author

HassenIO commented Aug 5, 2023

Is this not related to the TargetGroup requirement for the name to be less than 32 characters?

I found the following comment in the source code:

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

Also, the string waypoint-apollo-lambda-function- is 32 characters long, proving the issue comes from that.

A solution is to update the code example to a shorter app name. Also, I'm unsure if there is an option to set a custom TargetGroup name in the waypoint.hcl file (I'm just starting to learn it).

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