balderdashy / balderdashy/sails

Cannot connect to sockets on production

Open
#4,465 5 comments 0 reactions 0 assignees View on GitHub
more info please
Dominant language
JavaScript
Stars
22.8k
Forks
1.9k
PR merge metrics
No merged PRs in 30d

Description

**Sails version**: "sails": "^1.0.2",
**Node version**: v10.1.0
**NPM version**: 5.6.0
**DB adapter name**: "sails-postgresql":
**DB adapter version**: "^1.0.1"
**Operating system**: mac OS HighSierra 10.13.4 (17E202)


Hi,

Connecting to sockets on dev works fine.
When going to prod I'm declaring the config in an env variable but sails doesn't allow the connection.

I've enabled a log level to read (Note the trailing slash of the url):

![image](https://user-images.githubusercontent.com/1534092/42222156-4a342966-7ea2-11e8-9b79-3cc8f93a8c9e.png)

The env variable is read from Sails since when I delete it Sails doesn't allow to run the app as it throws an error saying that sockets allow origins is not set up.

![image](https://user-images.githubusercontent.com/1534092/42222229-8a54184e-7ea2-11e8-8d76-61a1faa410ba.png)

The problem is that somehow the env variable doesn't match with the string in the query. Could it be maybe the trailing slash that it outputs in the first image?

![image](https://user-images.githubusercontent.com/1534092/42222321-da62d10e-7ea2-11e8-94a2-09451629fa8e.png)

![image](https://user-images.githubusercontent.com/1534092/42222335-e6749dc4-7ea2-11e8-81c9-8e12b720e69f.png)

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the production socket connection with the configured environment variable and compare the logged allowed-origin value with the connection URL shown in the screenshots. Done means the production app accepts the intended socket connection using the environment configuration, including a clear result for the trailing-slash difference.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, node.js
Domain
backend, networking
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.