Currently attempting to implement a feature flag for a Typescript project using code from the Unleash Client. Here is where I am creating and connecting to an instance of unleash
with a local unleash setup as outlined in this documentation: Unleash GitHub Repository. Despite confirming that the unleash instance is running locally within a docker container as directed, I seem to be encountering a connection error. The service appears to be up and running when accessed through my browser. Can anyone shed light on why I am receiving the following error message upon connection attempt?
Snippet of CODE:
import express from 'express';
import { Unleash } from 'unleash-client';
const unleash = new Unleash({
url: 'http://localhost:4242/api/',
appName: 'default',
customHeaders: { Authorization: 'default:development.unleash-insecure-api-token' },
});
Error LOG:
FetchError: Unleash Repository error: request to http://localhost:4242/api/client/features failed, reason: connect ECONNREFUSED 127.0.0.1:4242
app-local-backend | [1] at ClientRequest.<anonymous> (/app/node_modules/minipass-fetch/lib/index.js:130:14)
app-local-backend | [1] at ClientRequest.emit (node:events:517:28)
app-local-backend | [1] at Socket.socketErrorListener (node:_http_client:501:9)
app-local-backend | [1] at Socket.emit (node:events:517:28)
app-local-backend | [1] at emitErrorNT (node:internal/streams/destroy:151:8)
app-local-backend | [1] at emitErrorCloseNT (node:internal/streams/destroy:116:3)
app-local-backend | [1] at process.processTicksAndRejections (node:internal/process/task_queues:82:21) {
app-local-backend | [1] code: 'ECONNREFUSED',
app-local-backend | [1] errno: 'ECONNREFUSED',
app-local-backend | [1] syscall: 'connect',
app-local-backend | [1] address: '127.0.0.1',
app-local-backend | [1] port: 4242,
app-local-backend | [1] type: 'system'
app-local-backend | [1] }
Oddly enough, I have the ability to access the endpoint using Postman following the provided documentation image below:
https://i.sstatic.net/uG2LN.png
Any guidance or assistance regarding this matter would be highly appreciated!