question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

BaseUrl isn't getting used

See original GitHub issue

I’m getting the following error when calling the auth function: ERROR Invoke Error { "errorType": "Error", "errorMessage": "connect ECONNREFUSED 127.0.0.1:8080", "trace": [ "Error: connect ECONNREFUSED 127.0.0.1:8080", " at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1107:14)" ] }

It looks like it’s trying to hit the default baseUrl even though i passed in a new baseUrl. Code is below:

const KeycloakAdminClient = require('keycloak-admin').default;

const settings = {
	baseUrl   : config.KeycloakBaseLocation,
	username  : config.KeycloakUsername,
	password  : config.KeycloakPassword,
	grant_type: 'password',
	client_id : 'admin-cli',
	realmName : config.KeycloakRealm
}

const client = new KeycloakAdminClient();
await client.auth(settings);

Issue Analytics

  • State:open
  • Created 3 years ago
  • Comments:6

github_iconTop GitHub Comments

1reaction
Kinranycommented, May 25, 2020

I’m getting the same error while using keycloak/keycloak-nodejs-connect, so your issue might be caused by something else

0reactions
itsalb3rtcommented, Oct 19, 2020

I think example in readme is wrong realm should be in the auth settings and baseUrl in the options for client constructor

@stevehogdahl try below it works for me

const KeycloakAdminClient = require('keycloak-admin').default;

const settings = {
  username  : config.KeycloakUsername,
  password  : config.KeycloakPassword,
  grant_type: 'password',
  client_id : 'admin-cli',
  realmName : config.KeycloakRealm
}

const client = new KeycloakAdminClient( {
  baseUrl: config.KeycloakBaseLocation,
});

await client.auth(settings);

No. The REAME is correct, In your case maybe you were using the wrong “realm” and by not putting “realmName” in “KeycloakAdminClient” the library put you the realm “master”

Read more comments on GitHub >

github_iconTop Results From Across the Web

BaseURL not being used · Issue #1470 · axios/axios
I'm having a problem with the defaults property. When an instance is created I'm setting the baseUrl, checking the defaults value I can...
Read more >
Axios baseURL is not appending with the URL in react.js
If you would like to understand what's happening, this is where axios builds the full path. It thinks you're passing an absolute URL...
Read more >
Base URL not being used for thumbnails and other links
Ive installed jira software (server) on my centos machine. through nginx server i forward the requests to jira.
Read more >
Request Config | Axios Docs
Requests will default to GET if method is not specified. ... is the request method to be used when making the request method:...
Read more >
API Host and Base Path
REST APIs have a base URL to which the endpoint paths are appended. ... If schemes are not specified, the scheme used to...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found