-
Notifications
You must be signed in to change notification settings - Fork 1
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
nodejs server-side client can't connect to dev-server #422
Comments
Thank you for the detailed bug report! Sorry you're running into this. The 401 in the logs indicate that your application failed to authenticate with the dev server, but it looks like you are correctly setting the SDK key to the project key, so that is surprising behavior. I can't tell from the screenshot if the flags are listed below where you cropped the image or if they're missing. Are there flags in the UI? Also, can you share the db file located at |
^ flags show in the UI ^ dev db, just has the sample from https://github.com/launchdarkly/ldcli/blob/main/internal/dev_server/sdk/project_key_middleware.go#L37 , it looks like 401 is thrown if the key is empty, could it be that the header is not being set? is there a good way to get deeper into what the node SDK is sending? is there a curl command i could run locally that should work? more context: running node v20 for the server app |
looks like the ldcli server is responding as appropriate with a valid auth header:
so it seems its not being sent by the nodejs server, unclear why. i have datadog installed, and that adds headers, but i dont think takes any away. ngrep shows no
i might try creating a fresh nodejs project and see if i can dupe the error with a clean slate |
OK. That's good that we were able to isolate the issue to the SDK via the curl request. Very strange that the SDK isn't setting the header. I confirmed that the authorization header gets set appropriately in our sample app when you set the SDK key to |
Describe the bug
I am setting up a LD dev-server in my local environment. I have
ldcli
setup locally via homebrew, access token added, and a project synced locally. I fire up my nodejs server backend, point to the dev-server and the LD client fails to initialize.setup ldcli:
add a project
open the ui and see
confirmed that the project exists and was able to sync from the LD servers
start up nodejs server (same machine) with following init code:
node js logs:
ldcli logs:
note: i see that the connection is good. the nodejs server can reach the ldcli dev-server, so hosts and ports are correct or at least valid. but the
401
response makes me think some auth is invalid. from https://docs.launchdarkly.com/guides/flags/ldcli-dev-server?q=dev+server#configure-your-sdk-for-testing it says to use the project id for the sdk key, which istoggle-runner-demo
as seem from the add-project line.Expected behavior
LD client initializes successfully, someother other than 4xx's in the ldcli logs about connecting.
Logs
see above
CLI version
nodejs sdk version:
"@launchdarkly/node-server-sdk@npm:^9.5.4":
installed from homebrew
OS/platform
macOS 12.7.2 (21G1974)
Additional context
a couple things i have tweaked in an attempt to fix this
GET /all
)/dev
The text was updated successfully, but these errors were encountered: