snyk-tech-services / backstage-plugin-snyk

Other
24 stars 25 forks source link

[🐛] 404 - Failed fetching Projects list snyk data #124

Open schultzp2020 opened 1 year ago

schultzp2020 commented 1 year ago

Expected behaviour

Please share expected behaviour.

<EntitySnykContent /> should render successfully without a 404 error.

Actual behaviour

Please share problematic behaviour you are seeing.

<EntitySnykContent /> renders with a 404 error.

Steps to reproduce

Please share minimal steps needed to reproduce your issue. Ideally a paired down manifest / project to showcase the problem that can also be used for testing.

I followed the README guide.

Steps I took to try to debug:

Debug log

If applicable, please add DEBUG=*snyk* <command here> before your command and include the output here **ensuring to remove any sensitive/personal details or tokens.

N/A

Screenshots

If applicable, add screenshots to help explain your problem.

aarlaud commented 1 year ago

Hello there, I'm not able to reproduce this issue but noticed something wrong in the readme instruction. Can you verify you're running this correctly following this doc update? https://github.com/snyk-tech-services/backstage-plugin-snyk/pull/125/files

schultzp2020 commented 1 year ago

Hey @aarlaud, it still does not work for us. Here is the branch/pr you can use to reproduce the issue. https://github.com/janus-idp/backstage-showcase/pull/112

aarlaud commented 1 year ago

hum.... and you're sure the token you're using has access to the project ids you're adding? We'll probably need to investigate a bit further into your specific case. Can you open a ticket with support@snyk.io telling them to ping me (antoine@snyk.io) so we can take a look a bit more closely on the side backend side?

thanks

aarlaud commented 1 year ago

Making notes for action. Shows Project Not found despite project being found but not being loaded due to API access. Making note here to improve error handling in SnykEntityComponent to handle error better, most likely when generateSnykTabForProject ends up in error.

jcospina commented 1 year ago

I am having the exact same issue. This is the config for the proxy:

  '/snyk':
    target: 'https://api.snyk.io'
    headers:
      User-Agent: tech-services/backstage-plugin/1.0
      Authorization: 'token REDACTED'
    pathRewrite:
      '^/proxy/snyk/': '/'

And i'm getting Error 404 - Failed fetching Targets list snyk data. When testing on postman hitting the snyk api directly it works (which means the token is valid) but the backstage proxy doesn't

swnia commented 11 months ago

Apparently, in the meantime the proxy settings have to be updated to this:

    '/snyk':
      target: https://api.snyk.io/
      headers:
        User-Agent: tech-services/backstage-plugin/1.0
        Authorization:
          $env: SNYK_TOKEN
      pathRewrite:
        '^/api/proxy/snyk/': '/'
aarlaud commented 10 months ago

Hum... my setup works with this alone

proxy:
  endpoints:
    /snyk:
      target: https://api.snyk.io/
      headers:
        User-Agent: tech-services/backstage-plugin/1.0
        Authorization: token ${SNYK_TOKEN}

Looks like you need a rewrite path for some reason. I'd like to add this to the README, but I'm unclear why you need it and I don't, and why it doesn't seem to be for everyone. Is there a proxy setting somewhere in your setup that differs from the basic create-app scenario?

swnia commented 10 months ago

I did not change anything around proxying except for the entry for this plugin.