You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have created a node api that publish messages using a faye client and would like to use the https connection.
In local environment it is working just fine in my faye client I have the certificate and key in place, and it is coming up as https://localhost:4001 and in node api side I have the config pointing to the correct url and using the tls: {ca: certificate.pem}.
It works like a charm, but when I create each service on a container the node api is not able to connect with the faye client.
async function start() {
// load config
await ConfigService.init("/conf/config.local.json");
// Create a https server instance
const sslOptions = {
key: fs.readFileSync("/certificate.key", "utf8"),
cert: fs.readFileSync("/certificate.crt", "utf8")
}
const httpServerInstance = https.createServer(sslOptions, nonBayeuxHandler);
// Create a Faye instance
const bayeux = new Faye.NodeAdapter({
mount: "/prism-faye", // this is the prefix on which faye will be mounted
timeout: 30
});
// attach faye to http server
bayeux.attach(httpServerInstance);
// Add authentication to restrict publish only to servers
authHandler(bayeux, ConfigService.config());
// Start Server
httpServerInstance.listen(Environment.getPort(DEFAULT_PORT), Environment.getHost(DEFAULT_HOST), () => {
AppLogger.info(
"FAYE HTTP Server Started Successfully: Host = " + Environment.getHost(DEFAULT_HOST) + ", Port = " +
Environment.getPort(DEFAULT_PORT)
);
});
}
/* Common Code */
start()
.then(() => {
AppLogger.info("Faye server started successfully.");
})
.catch((err) => {
AppLogger.error("Error starting Faye server. Send notification.", err);
});
`
I spent sometime looking for a solution but not able to identify where is the issue, as it works locally, but doesn't work when I bring the code to the container.
the only difference I see in console logs is in the node api
LOCAL -> Faye Client Up
CONTAINER of NODE API -> Faye Client Down
Just as more info: I'm using mac and podman to create the containers
The text was updated successfully, but these errors were encountered:
Im not familiar with this container platform so I can't say what's going on here. My gut reaction is that if you got your application working in another environment then it's probably not a problem with the code per se but some environmental difference.
What I would do in this situation is to build understanding of the container platform by first building something simpler on top of it. For example, first write something (anything, just a toy example will do) using just the Node http module and get that working to iron out any networking issues. Then convert that example to https and get your certificates working. Only then would I start building an actual application.
I have created a node api that publish messages using a faye client and would like to use the https connection.
In local environment it is working just fine in my faye client I have the certificate and key in place, and it is coming up as https://localhost:4001 and in node api side I have the config pointing to the correct url and using the tls: {ca: certificate.pem}.
It works like a charm, but when I create each service on a container the node api is not able to connect with the faye client.
NODE API
`
`
FAYE-PUBSUB
`
`
I spent sometime looking for a solution but not able to identify where is the issue, as it works locally, but doesn't work when I bring the code to the container.
the only difference I see in console logs is in the node api
LOCAL -> Faye Client Up
CONTAINER of NODE API -> Faye Client Down
Just as more info: I'm using mac and podman to create the containers
The text was updated successfully, but these errors were encountered: