Skip to content
This repository was archived by the owner on Jul 22, 2024. It is now read-only.
This repository was archived by the owner on Jul 22, 2024. It is now read-only.

Login fails when not from localhost:3000 #79

Description

@fpservant

When connecting at localhost:3000, everything is fine. But when using machine's IP address:3000, even from the same machine (and also using 127.0.0.1:3000), login doesn't work.
Seems to be a problem with CORS. Message displayed by safari:

Could not authenticate: Origin http://192.168.1.14:3000 is not allowed by Access-Control-Allow-Origin.

Message in console:

[0] [2019-11-07T07:32:21.653Z]  WARN: express/21655 on fpsmacbook.home: ::1 <-- GET /api/user HTTP/1.1 401 49 http://192.168.1.14:3000/ Safari 13.0 Mac OS X 10.15.1 2.639276 ms (req_id=52f4d1ad-0fe9-4299-a05c-4ad5d5860ab1, remote-address=::1, ip=::1, method=GET, url=/api/user, referer=http://192.168.1.14:3000/, body={}, short-body={}, http-version=1.1, response-time=2.639276, status-code=401, incoming=<--)

(Using mac OSX latest release)

Don't know whether this is related, but I have several errors displayed in the console when starting:

> train-custom-speech-model@0.1.0 dev /Users/fps/_fps/GitRepositories/Train-Custom-Speech-Model
> npm run build && concurrently --kill-others-on-fail "npm run start" "npm run client"


> train-custom-speech-model@0.1.0 build /Users/fps/_fps/GitRepositories/Train-Custom-Speech-Model
> npm run build-client && tsc


> train-custom-speech-model@0.1.0 build-client /Users/fps/_fps/GitRepositories/Train-Custom-Speech-Model
> cd client && npm install


> fsevents@1.2.4 install /Users/fps/_fps/GitRepositories/Train-Custom-Speech-Model/client/node_modules/fsevents
> node install

node-pre-gyp WARN Tried to download(404): https://fsevents-binaries.s3-us-west-2.amazonaws.com/v1.2.4/fse-v1.2.4-node-v72-darwin-x64.tar.gz 
node-pre-gyp WARN Pre-built binaries not found for fsevents@1.2.4 and node@12.13.0 (node-v72 ABI, unknown) (falling back to source compile with node-gyp) 
No receipt for 'com.apple.pkg.CLTools_Executables' found at '/'.

No receipt for 'com.apple.pkg.DeveloperToolsCLILeo' found at '/'.

No receipt for 'com.apple.pkg.DeveloperToolsCLI' found at '/'.

gyp: No Xcode or CLT version detected!
gyp ERR! configure error 
gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onCpExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:351:16)
gyp ERR! stack     at ChildProcess.emit (events.js:210:5)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:272:12)
gyp ERR! System Darwin 19.0.0
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "configure" "--fallback-to-build" "--module=/Users/fps/_fps/GitRepositories/Train-Custom-Speech-Model/client/node_modules/fsevents/lib/binding/Release/node-v72-darwin-x64/fse.node" "--module_name=fse" "--module_path=/Users/fps/_fps/GitRepositories/Train-Custom-Speech-Model/client/node_modules/fsevents/lib/binding/Release/node-v72-darwin-x64" "--napi_version=5" "--node_abi_napi=napi"
gyp ERR! cwd /Users/fps/_fps/GitRepositories/Train-Custom-Speech-Model/client/node_modules/fsevents
gyp ERR! node -v v12.13.0
gyp ERR! node-gyp -v v5.0.5
gyp ERR! not ok 
node-pre-gyp ERR! build error 
node-pre-gyp ERR! stack Error: Failed to execute '/usr/local/bin/node /usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js configure --fallback-to-build --module=/Users/fps/_fps/GitRepositories/Train-Custom-Speech-Model/client/node_modules/fsevents/lib/binding/Release/node-v72-darwin-x64/fse.node --module_name=fse --module_path=/Users/fps/_fps/GitRepositories/Train-Custom-Speech-Model/client/node_modules/fsevents/lib/binding/Release/node-v72-darwin-x64 --napi_version=5 --node_abi_napi=napi' (1)
node-pre-gyp ERR! stack     at ChildProcess.<anonymous> (/Users/fps/_fps/GitRepositories/Train-Custom-Speech-Model/client/node_modules/fsevents/node_modules/node-pre-gyp/lib/util/compile.js:83:29)
node-pre-gyp ERR! stack     at ChildProcess.emit (events.js:210:5)
node-pre-gyp ERR! stack     at maybeClose (internal/child_process.js:1021:16)
node-pre-gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:283:5)
node-pre-gyp ERR! System Darwin 19.0.0
node-pre-gyp ERR! command "/usr/local/bin/node" "/Users/fps/_fps/GitRepositories/Train-Custom-Speech-Model/client/node_modules/fsevents/node_modules/node-pre-gyp/bin/node-pre-gyp" "install" "--fallback-to-build"
node-pre-gyp ERR! cwd /Users/fps/_fps/GitRepositories/Train-Custom-Speech-Model/client/node_modules/fsevents
node-pre-gyp ERR! node -v v12.13.0
node-pre-gyp ERR! node-pre-gyp -v v0.10.0
node-pre-gyp ERR! not ok 
Failed to execute '/usr/local/bin/node /usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js configure --fallback-to-build --module=/Users/fps/_fps/GitRepositories/Train-Custom-Speech-Model/client/node_modules/fsevents/lib/binding/Release/node-v72-darwin-x64/fse.node --module_name=fse --module_path=/Users/fps/_fps/GitRepositories/Train-Custom-Speech-Model/client/node_modules/fsevents/lib/binding/Release/node-v72-darwin-x64 --napi_version=5 --node_abi_napi=napi' (1)
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.4 (node_modules/fsevents):
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.4 install: `node install`
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: Exit status 1

audited 37839 packages in 12.813s
found 69 vulnerabilities (63 low, 6 high)
  run `npm audit fix` to fix them, or `npm audit` for details
[0] 
[0] > train-custom-speech-model@0.1.0 start /Users/fps/_fps/GitRepositories/Train-Custom-Speech-Model
[0] > npm run serve
[0] 
[1] 
[1] > train-custom-speech-model@0.1.0 client /Users/fps/_fps/GitRepositories/Train-Custom-Speech-Model
[1] > cd client && npm run start
[1] 
[1] 
[1] > speech-app@0.1.0 start /Users/fps/_fps/GitRepositories/Train-Custom-Speech-Model/client
[1] > react-scripts start
[1] 
[0] 
[0] > train-custom-speech-model@0.1.0 serve /Users/fps/_fps/GitRepositories/Train-Custom-Speech-Model
[0] > node dist/server.js | bunyan
[0] 
[0]   App is running at http://localhost:5000       in development mode
[0]   Press CTRL-C to stop
[1] Starting the development server...
[1] 
[1] Compiled successfully!
[1] 
[1] You can now view speech-app in the browser.
[1] 
[1]   Local:            http://localhost:3000/
[1]   On Your Network:  http://192.168.1.14:3000/
[1] 
[1] Note that the development build is not optimized.
[1] To create a production build, use npm run build.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions