namxam

namxam

Phoenix.js not reconnecting when server runs in Docker container

I have a nodejs application which uses the phoenix javascript package to connect to a phoenix application. It works fine as long as I do not restart the phoenix application. Once I restart it, I have to manually restart the node app as well.

I tried various setups, but it seems to be an issue with docker. Whenever I start the app locally (iex -S mix phx.server, mix phx.server, mix release && _…, prod and dev) it works as expected. After shutting down my phoenix app, node tries to reconnect. But as soon as I start the release in my docker container, node does not try to reconnect any more.

I also created a minimal web app which does show the same symptoms. Just to make sure, that it is not related to the node js websocket libraries.

UPDATE: I created a new socket + channel for testing purposes and it seems to be working there. So there has to be something wrong with my socket or channel implementation.

UPDATE: By carefully removing code, it boiled down to an issue with Phoenix.Tracker.
When removing the Phoenix.Tracker.track(…) code it works without any issues.

Has anyone an idea what might cause this behaviour. I guess I made a mistake but I have no idea which :smiley:

Marked As Solved

namxam

namxam

Well, I found the issue and it all boiled down to the fact, that I had my Phoenix.Tracker started after my Endpoint implementation. I still don’t know why this only happens when packaging in a docker container, but it now works.

Where Next?

Popular in Questions Top

baxterw3b
Hi guys, i’m new in the Elixir world, and i have to say, that i love it! i’m having some problem to understand anonymous functions with ...
New
jononomo
I am trying to figure out how Mix knows whether the environment is test, dev, or prod – where is this set? Thanks.
New
New
hariharasudhan94
Lets say I have map like this fetching from my database %{"_id" => #BSON.ObjectId<58eb1a7a9ad169198c3dXXXX>, "email" => ...
New
komlanvi
Hi everyone, I was playing with phoenix liveView but I run into an issue. I have a form and want to validate each input text when the te...
New
dblack
I’ve got an issue with an app and I’ve no idea of how to troubleshoot it. I’m hoping someone here might have seen something similar. I p...
New
romenigld
I am trying to run a deploy with docker and I successfully runned with this command: docker build -t romenigld/blog-prod . but when I t...
New

Other popular topics Top

rms.mrcs
Hi, I need to transform a list of numbers into a map where the keys are the indexes and the values are the original values of the list. ...
New
JakeBecker
TL;DR: I’ve just released an implementation of Microsoft’s IDE-independent Language Server Protocol for Elixir. It adds language support ...
1144 54921 245
New
jononomo
For some reason my phoenix channels are working for me in my local dev environment, but as soon as I deploy via Docker, I get a 403 error...
New
greenz1
I have a phoenix application from which a user can download multiple(5-6) files of size 1MB. I couldn’t find anything related to sending ...
New
bsollish-terakeet
Credo is smart enough to check for (something like) this: assert length(the_list) == 0 with this response: Checking if an enum is empt...
New
TunkShif
This post is an instruction guide to help you setup your Neovim for Elixir development from scratch. It includes general information on h...
274 42533 114
New

We're in Beta

About us Mission Statement