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

Invalid URL Errors during GitlabFillerProcessor execution #119

Closed
faisyl opened this issue Mar 4, 2023 · 5 comments · Fixed by #120
Closed

Invalid URL Errors during GitlabFillerProcessor execution #119

faisyl opened this issue Mar 4, 2023 · 5 comments · Fixed by #120
Labels
bug Something isn't working

Comments

@faisyl
Copy link

faisyl commented Mar 4, 2023

Adding backstage-plugin-gitlab causes entity postprocessing to start failing for the gitlab provider with the following error:

backstage-new-backstage-1  | {"entity":"group:default/dev1","level":"warn","location":"url:git.panka.in/teams/dev1","message":"Processor GitlabFillerProcessor threw an error while postprocessing; caused by TypeError [ERR_INVALID_URL]: Invalid URL","plugin":"catalog","service":"backstage","type":"plugin"}
backstage-new-backstage-1  | {"entity":"group:default/gitlab-instance-97cc0186","level":"warn","location":"url:git.panka.in/teams/gitlab-instance-97cc0186","message":"Processor GitlabFillerProcessor threw an error while postprocessing; caused by TypeError [ERR_INVALID_URL]: Invalid URL","plugin":"catalog","service":"backstage","type":"plugin"}
backstage-new-backstage-1  | {"entity":"user:default/root","level":"warn","location":"url:git.panka.in/root","message":"Processor GitlabFillerProcessor threw an error while postprocessing; caused by TypeError [ERR_INVALID_URL]: Invalid URL","plugin":"catalog","service":"backstage","type":"plugin"}
backstage-new-backstage-1  | {"entity":"user:default/user1","level":"warn","location":"url:git.panka.in/user1","message":"Processor GitlabFillerProcessor threw an error while postprocessing; caused by TypeError [ERR_INVALID_URL]: Invalid URL","plugin":"catalog","service":"backstage","type":"plugin"}

The baseUrl and host entries are set correctly:

integrations:
  gitlab:
    - host: git.panka.in
      token: ${GITLAB_TOKEN}
      apiBaseUrl: https://git.panka.in/api/v4
      baseUrl: https://git.panka.in

Anything I am missing in my configuration here?

@antoniomuso
Copy link
Contributor

Hi @faisyl, It seems that your locations are not valid URLs. they don't have the protocol... So I think the problem is relative to the configuration you have passed in.
In fact, seems that you have added to the allowedKinds configuration the Kinds Group and User, you can fix by removing it as follow:

gitlab:
-      allowedKinds: ['Component', 'User', 'Group' ]
+      allowedKinds: ['Component']

@faisyl
Copy link
Author

faisyl commented Mar 4, 2023

I have orgEnabled for the gitlab discovery plugin. Here's my complete app-config. I can't see anything here that isn't URLized correctly. Am I missing something here?

app:
  title: Panka Backstage
  baseUrl: https://genesis.panka.in

organization:
  name: Panka

backend:
  baseUrl: https://genesis.panka.in
  listen: ':7007'

  database:
    client: pg
    connection:
      host: ${POSTGRES_HOST}
      port: ${POSTGRES_PORT}
      user: ${POSTGRES_USER}
      password: ${POSTGRES_PASSWORD}

  cache:
    store: memory

integrations:
  gitlab:
    - host: git.panka.in
      token: ${GITLAB_TOKEN}
      apiBaseUrl: https://git.panka.in/api/v4
      baseUrl: https://git.panka.in

techdocs:
  builder: 'local' 
  runIn: 'docker'
  publisher:
    type: 'local' 


auth:
  environment: production
  providers:
    gitlab:
      production:
        clientId: ${GITLAB_CLIENT_ID}
        clientSecret: ${GITLAB_CLIENT_SECRET}
        audience: https://git.panka.in

catalog:
  providers:
    gitlab:
      panka:
        host: git.panka.in
        branch: main
        projectPattern: '[\s\S]*'
        orgEnabled: true
        schedule: 
          frequency: { minutes: 30 }
          timeout: { minutes: 3 }

@antoniomuso
Copy link
Contributor

Ok, this is a plugin bug. In the processor, we first do the location check, and after we do the kind check, We can invert these checks and handle the errors. Thanks for the report.
I schedule the release of the fix on Monday. Thank faisyl.

@antoniomuso antoniomuso added the bug Something isn't working label Mar 4, 2023
@antoniomuso
Copy link
Contributor

antoniomuso commented Mar 6, 2023

Hi faisyl, I fixed it with the last release v4.0.1.

@faisyl
Copy link
Author

faisyl commented Mar 7, 2023 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants