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

[Bug]: Data Hub (v1.5.4) seems to break when using multiple API Keys in GraphQL API configuration #794

Closed
khenow1978 opened this issue Aug 30, 2023 · 2 comments
Assignees
Labels
Milestone

Comments

@khenow1978
Copy link

Expected behavior

When the user configures a GraphQL API to use several API Keys it's supposed to accept any of these key as authentification and returns the JSON result of the query.

image

Actual behavior

Within the GraphiQL Playground all Keys are smashed together to one large key and the API doesn't work correctly:

image

The Playground mentions this error message:

image

I have undone these changes in order to return to the state before but that doesn't work either. In fact NO API works anymore.. even if I create a new one with only one key. They all return HTML code instead of JSON.

So I did some further testing with a small Python script I wrote for this purpose:

image

As you can see it returns HTML code (that is in fact the Login Page from the Portal Engine) although I sent a proper query. When I exchange the transport with the production system API it works fine.

Even the connection itself isn't working properly anymore. In production when I forget to send the API Key I receive HTTP 400 but in the dev environment the result is always HTTP 200. That's not making a lot of sense to me.

I have upgrade from v1.5.4 to v1.5.8 in order to see if this resolves the issue. It didn't. Currently we are using Pimcore 10.5.14. The only short term solution would be to install Pimcore from scratch as Dev environment and start all over and see if the issue occurs once again.

Steps to reproduce

  • Create a new GraphQL API

  • Add several API Keys to the security section

  • Save the API

  • Try to use the GraphiQL Playground OR

  • Try to access the API from an external source

@khenow1978 khenow1978 added the Bug label Aug 30, 2023
@khenow1978
Copy link
Author

After I've installed Pimcore once again, I've tried to reproduce the error but it didn't happen. Now the behaviour is as expected besides one issue which remains. Let's say you've created an API with 3 Keys:
image

Now, when you start the playground this happens:
image

All 3 Keys are smashed together to one string rather than an array (is this even possible as X-API-KEY??) and you get a permission error (Importan. NOT a DocType error). The solution is to take one of the 3 Keys from the API and replace the wrong key with the correct one:

image

Now it works.. I'm not sure if this is an expected behaviour because everytime you want to use the playground you have to keep in mind to replace the API Key..

@dvesh3
Copy link
Contributor

dvesh3 commented Sep 6, 2023

Fixed by #795

@dvesh3 dvesh3 closed this as completed Sep 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants