Issue with CloudFormation and Git sync not working with GitLab


Looking to explore the recently announced Git sync for CloudFormation, having problems, wondering what I'm doing wrong?

I'm using GitLab, I have a private repo with a single template (to create a CloudWatch Log Group). Successfully created the CodeStar Connection, visible in the console and via the CLI (aws codestar-connections list-connections).

From the CloudFormation console, create the stack and use the new Git sync feature (as per the AWS documentation, the CloudFormation console shows an error when attempting to retrieve the branch:

CloudFormation error loading branch name

I can see in CloudTrail that there is a call to UseConnection from, which shows:

"responseElements": {
        "repositories": [
                "repositoryId": "clattering-flumps",
                "repositoryDisplayName": "Clattering Flumps",
                "ownerId": "{my user name}",
                "ownerDisplayName": "{my display name}",
                "fullRepositoryId": "{my user name}/clattering-flumps",
                "isPrivate": true,
                "description": "Exploration of the new CloudFormation/GitLab integration for stack creation...",
                "capabilities": {
                    "gitClone": true,
                    "archiveUpload": true
                "sizeInBytes": 5415

which matches what I expect, however, I see an HTTP POST originated from my browser in the console which shows another invocation of the UseConnection API in CloudTrail, but this time, with the parameter supplied by the client, which is wrong? The request sends

{"ConnectionArn":"arn:aws:codestar-connections:eu-west-2:xxxxxxxxxxxx:connection/609f8c07-dead-beef-8462-c152xyzc302b","Parameters":{"FullRepositoryId":"{my user name}/Clattering Flumps"},"MaxResults":100}

resulting in a 400 HTTP response with the payload:

	"__type": "com.amazonaws.codestar.connections#ProviderResourceNotFoundException",
	"Message": "404 Project Not Found"

In case it is useful, user agent string from my browser is Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:120.0) Gecko/20100101 Firefox/120.0. I have updated the AWS cli via brew, version is aws-cli/2.13.39 but neither use-connection is present for CodeStar Connections, or any git related entries seem to be there for CloudFormation create-stack?

Happy to be told I'm an idiot who's missed something obvious, but the console is guiding me and the API call from the browser to AWS appears to set the FullRepositoryId to a value which is my GitLab username and the repo Display Name, not the repo path ¯\_(ツ)_/¯

Update: Changing the GitLab repo Dislpay Name to clattering-flumps results in success... Definitely looks like a bug to me?

1 Answer

Also the project needs to be in the root of you account.

A repo with the name fails, moving the project to succeeds

answered 2 months ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions