I’ve got a weird websocket error when I deploy my app using edeliver:
WebSocket connection to 'ws://staging.cur-vita.com/socket/websocket?token=undefined&vsn=2.0.0' failed: Error during WebSocket handshake: net::ERR_CONNECTION_RESET
I do not know what went wrong, everything is working fine locally (both dev and prod env).
Did anybody had a similar error?
My prod config:
config :curvita, CurvitaWeb.Endpoint,
http: [port: 4000],
url: [host: "localhost", port: 80],
check_origin: true,
cache_static_manifest: "priv/static/cache_manifest.json",
server: true,
root: ".",
version: Mix.Project.config[:version]
# Do not print debug messages in production
config :logger, level: :info
config :curvita, :environment, :prod
my edeliver config is:
APP="curvita"
BUILD_HOST="staging.cur-vita.com"
BUILD_USER="deploy"
BUILD_AT="/tmp/edeliver/$APP/builds"
RELEASE_DIR="/tmp/edeliver/$APP/builds/_build/prod/rel/$APP"
# prevent re-installing node modules; this defaults to "."
GIT_CLEAN_PATHS="_build rel priv/static"
# STAGING_HOSTS="188.166.182.170"
# STAGING_USER="deploy"
# TEST_AT="/home/deploy/staging"
PRODUCTION_HOSTS="staging.cur-vita.com"
PRODUCTION_USER="deploy"
DELIVER_TO="/home/deploy"
# For *phx* projects, symlink prod.secret.exs to our tmp source
pre_erlang_get_and_update_deps() {
local _prod_secret_path="/home/deploy/prod.secret.exs"
if [ "$TARGET_MIX_ENV" = "prod" ]; then
__sync_remote "
ln -sfn '$_prod_secret_path' '$BUILD_AT/config/prod.secret.exs'
"
fi
}
pre_erlang_clean_compile() {
status "Running phx.digest" # log output prepended with "----->"
__sync_remote " # runs the commands on the build host
# [ -f ~/.profile ] && source ~/.profile # load profile (optional)
source ~/.profile
# echo \$PATH # check if rbenv is in the path
set -e # fail if any command fails (recommended)
cd '$BUILD_AT' # enter the build directory on the build host (required)
# prepare something
mkdir -p priv/static # required by the phx.digest task
cd ./assets
npm install
./node_modules/.bin/webpack -p
cd ../
# run your custom task
APP='$APP' MIX_ENV='$TARGET_MIX_ENV' $MIX_CMD phx.digest $SILENCE
"
}
@Gazler thx for your reply
I had the host set already but changed later to localhost.
The log file indeed showed me this error you have mentioned, but not anymore.
Still I get the same error message again.
I have also added some origins there.
@dyyce If you are running on port 4000 and it works on port 4000, then I assume you have some sort of reverse proxy (nginx, haproxy, etc) running on port 80? In that case, it is certainly worth checking that the websockets aren’t being stopped at that level.