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

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

Open
schultzp2020 opened this issue Mar 15, 2023 · 8 comments
Open

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

schultzp2020 opened this issue Mar 15, 2023 · 8 comments
Labels
question Further information is requested

Comments

@schultzp2020
Copy link

  • node -v: 18.12.1
  • yarn -v: 3.4.1
  • OS: (e.g. OSX, Linux, Windows, ...) Windows
  • Command run: (e.g. snyk-api-import ..., ...) 1.2.7

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:

  • Followed the recommended proxy 404 error workaround
  • Changed the token to be incorrect which gave me a 401 auth error

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
Copy link
Contributor

aarlaud commented Mar 16, 2023

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
Copy link
Author

Hey @aarlaud, it still does not work for us. Here is the branch/pr you can use to reproduce the issue. redhat-developer/rhdh#112

@aarlaud
Copy link
Contributor

aarlaud commented Mar 20, 2023

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
Copy link
Contributor

aarlaud commented Mar 21, 2023

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.

@aarlaud aarlaud added bug Something isn't working enhancement New feature or request labels Mar 21, 2023
@jcospina
Copy link

jcospina commented Jul 5, 2023

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
Copy link

swnia commented Nov 17, 2023

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
Copy link
Contributor

aarlaud commented Nov 27, 2023

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?

@aarlaud aarlaud added question Further information is requested and removed bug Something isn't working enhancement New feature or request labels Nov 27, 2023
@swnia
Copy link

swnia commented Nov 28, 2023

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

4 participants