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.

Resource endpoints fail with 404 due to incorrectly constructed URLs

See original GitHub issue

Thanks for this library which looks great! 😃

I am having an issue running a simple quickstart to authenticate with keycloak and list clients:

#!/usr/bin/env node

import KcAdminClient from 'keycloak-admin';

async function main() {
    const kcAdminClient = new KcAdminClient({
        baseUrl: 'http://localhost:8081/keycloak/auth',
        realmName: 'realm'
    });

    await kcAdminClient.auth({
        username: 'username',
        password: 'password',
        grantType: 'password',
        clientId: 'admin-cli'
    });

    await kcAdminClient.clients.find()
        .catch(err => console.log(err));

}

main();

But on the clients.find() line I get an error

Error: Request failed with status code 404

Looking into the error object the request URL was

http://localhost:8081/keycloak/auth%5Cadmin%5Crealms%5Crealm%5Cclients

i.e. it seems the URL has been constructed and/or encoded incorrectly.

I am running the script via

ts-node index.ts

Have you seen this before? Is there a known fix and/or workaround?

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
adamsmith448commented, Sep 28, 2018

Nice, that has fixed it, thank you!

Thanks for the quick response & fix 😃

0reactions
wwwy3y3commented, Sep 28, 2018

Glad to hear that 😀

Read more comments on GitHub >

github_iconTop Results From Across the Web

Resource endpoints fail with 404 due to incorrectly ... - GitHub
i.e. it seems the URL has been constructed and/or encoded incorrectly. I am running the script via. ts-node index.ts.
Read more >
REST API 404: Bad URI, or Missing Resource? - Stack Overflow
I have a service which returns data. But there's situations where the data is broken. The request URL is correct (so not a...
Read more >
404 Not Found Error: What It Is and How to Fix It - Airbrake Blog
The 404 Not Found Error is an HTTP response status code, which indicates that the requested resource could not be found.
Read more >
Troubleshooting Azure CDN endpoints - 404 status code
Users who attempt to access your content via the CDN URL receive an HTTP 404 status code. Cause. There are several possible causes,...
Read more >
Debugging the Spring MVC 404 “No mapping found for HTTP ...
As with any web application or website, Spring MVC returns the HTTP 404 response code when the requested resource can't be found.
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