I'm trying to run backstage on AWS Fargate, but I'm facing a problem fetching the service catalog that is hosted on a private gitlab.
Both gitlab and backstage are running on the same vpc and same private subnets.
When I run backstage both locally with yarn dev
and docker, backstage can fetch the catalog with no problem. But when I run a task in Fargate, he can't fetch it.
The error presented on backstage is:
When I call the entites api on /api/catalog/entities
, the return is:
"status": {
"items": [
{
"type": "backstage.io/catalog-processing",
"level": "error",
"message": "Error: Unable to read url, Error: Could not get GitLab project ID for: https://gitlab.srv-cld.xxx.com.br/x/x/backstage-architecture/-/blob/master/systems/user/services/document-service/api.yaml, Error: GitLab Error 'undefined', undefined",
"error": {
"name": "Error",
"message": "Unable to read url, Error: Could not get GitLab project ID for: https://gitlab.srv-cld.xxx.com.br/x/x/backstage-architecture/-/blob/master/systems/user/services/document-service/api.yaml, Error: GitLab Error 'undefined', undefined"
}
}
...
]
}
The catalog on app-config.yml is:
catalog:
import:
entityFilename: catalog-info.yaml
pullRequestBranchName: backstage-integration
rules:
- allow: [Component, System, API, Resource, Location]
locations:
- type: url
target: https://gitlab.aaa.bbb.com.br/arquitetura/exemplos/backstage-architecture/-/blob/master/architecture.yaml
And the integrations is:
integrations:
gitlab:
- host: gitlab.aaa.bbb.com.br
apiBaseUrl: https://gitlab.aaa.bbb.com.br/api/v4
token: ${GITLAB_TOKEN}
I really can't understand why backstage can't get the project id when running on fargate.
Just to close the question, it was not a problem with backstage or self hosted gitlab. It was a problem mapping the env GITLAB_TOKEN
in the task definition.