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.

Can't connect to server with token authentication.

See original GitHub issue

Hello, First off thank you for writing this code. We rely on NATS and js so this is very useful for us.

I have tried connecting to a remote NATS server with token authentication and can’t. My subscriptions don’t receive data I send. I’m using nats@beta. My code works fine when testing with a local server that has token authentication. Our remote server is 3 NATS instances as a supercluster behind a Kubernetes load balancer.

Can you help me debug this? I tried Python and nats-pub/nats-sub; they work successfully.

Here is my sample code: https://gist.github.com/roguh/9c220782640279d040ee563c23300432

Here’s the output:

$ 
NATS_AUTH_TOKEN=... NATS_URL=nats://localhost:4222 node src/nats_test.js
subscribing to test
publishing to test
Error: test publish and subscribe failed. messages received: 

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
roguhcommented, Jan 27, 2021

Your sample runs fine.

I caught the problem! I didn’t use {callback: ...}

1reaction
aricartcommented, Jan 26, 2021

It would be helpful for you to show your server configuration.

Read more comments on GitHub >

github_iconTop Results From Across the Web

ERROR: Could not authenticate with the provided token
Make sure the token is valid/active and the Anypoint Platform user who generates the token has "Manage Servers" permission for that environment.
Read more >
Can't connect to authentification server : r/EliteDangerous
Hi, I have problems logging into the authentication server. When I start the game (via Steam VR) an error message is displayed that...
Read more >
How to fix League's 'unable to connect to the authentication ...
The first thing you should do is check your server status. There's a good chance the issue isn't at your end and Riot...
Read more >
Troubleshoot Invalid Token Errors - Auth0
Error Message: The ID token cannot be validated because it was signed using the HS256 algorithm and public applications (such as a browser)...
Read more >
User can't authenticate or must authenticate twice
Troubleshooting an issue in which user can't authenticate or must authenticate twice when starting a remote desktop connection.
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