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

Using username nad password for authentication leads to error #330

Closed
motabass opened this issue Jan 2, 2023 · 4 comments · Fixed by #367 or #366 · May be fixed by nodeshift/nodeshift#747
Closed

Using username nad password for authentication leads to error #330

motabass opened this issue Jan 2, 2023 · 4 comments · Fixed by #367 or #366 · May be fixed by nodeshift/nodeshift#747

Comments

@motabass
Copy link

motabass commented Jan 2, 2023

I'm getting the following error when i try to use a config like this:

config = {
    url: process.env.OPENSHIFT_API_URL,
    auth: {
      username: process.env.OPENSHIFT_ADMIN_USERNAME,
      password: process.env.OPENSHIFT_ADMIN_PASSWORD
    },
    insecureSkipTlsVerify: true
  };
    throw new InvalidArgumentError('invalid url')
          ^
InvalidArgumentError: invalid url
    at Object.parseOrigin (/home/mohoritsch/WORKSPACE/customer.portal/mng-clients/node_modules/undici/lib/core/util.js:109:11)
    at new Client (/home/mohoritsch/WORKSPACE/customer.portal/mng-clients/node_modules/undici/lib/client.js:199:23)
    at /home/mohoritsch/WORKSPACE/customer.portal/mng-clients/node_modules/openshift-rest-client/lib/basic-auth-request.js:44:20
    at new Promise (<anonymous>)
    at getTokenFromBasicAuth (/home/mohoritsch/WORKSPACE/customer.portal/mng-clients/node_modules/openshift-rest-client/lib/basic-auth-request.js:40:10)
    at processTicksAndRejections (node:internal/process/task_queues:95:5)
@lholmquist
Copy link
Member

what version of the client are you using?

in the 7.1.x release we updated somethings, would could be the culprit. if you are using 7.1.x, could you try the 7.0.0 release to see if that works. If it does, then that should narrow the problem down and we can get a fix out.

Also, if possible, could you share what the value of process.env.OPENSHIFT_API_URL is?

@mkalam-alami
Copy link

mkalam-alami commented Feb 16, 2023

Hi,

I confirm the problem is related to 7.1+, the stacktrace provided in the original post points to a problematic integration of unidici in basic-auth-request.js (it seems like the lib expects a root URL when creating the client instead of a full URL with a pathname).

Version 7.0.0 works fine.

@lholmquist
Copy link
Member

based on @mkalam-alami 's analysis, i think i know how to fix this

lholmquist added a commit to lholmquist/openshift-rest-client that referenced this issue Jul 12, 2023
lholmquist added a commit that referenced this issue Jul 12, 2023
* fix: This fixes the url that is passed into the undici client.

fixes #330
@lholmquist
Copy link
Member

hopefully the fix released in 8.0.1 will fix this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment