jovo-cli icon indicating copy to clipboard operation
jovo-cli copied to clipboard

"jovo run" should throw an error if selected default port is already being used

Open stuart-clark-45 opened this issue 5 years ago • 7 comments

I'm submitting a...

  • [x] Bug report
  • [x] Feature request
  • [ ] Documentation issue or request
  • [ ] Other... Please describe:

Expected Behavior

jovo run should throw an error if selected default port is already being used

Current Behavior

everything appears to start up fine, so kinda looks like jovo just isn't working to the new user such as myself

Your Environment

Jovo CLI Version: 2.2.7

Jovo packages of current project: jovo-cms-i18next: 2.2.10 jovo-core: 2.2.9 jovo-db-filedb: 2.2.9 jovo-framework: 2.2.12 jovo-platform-alexa: 2.2.14 jovo-platform-dialogflow: 2.2.10 jovo-platform-googleassistant: 2.2.12 jovo-plugin-debugger: 2.2.10

ProductName: Mac OS X ProductVersion: 10.13.4 BuildVersion: 17E202

stuart-clark-45 avatar Jul 09 '19 14:07 stuart-clark-45

Hi @stuart-clark-45, thank you.

I typically get an error like this when I try to run the server when the port is already used in a different tab:

Error -----------------------------------------------------------------
  
  Code:
  EADDRINUSE
  
  Message:
  listen EADDRINUSE :::3000
  
  Stack:
  Error: listen EADDRINUSE :::3000
      at Object._errnoException (util.js:1022:11)
      at _exceptionWithHostPort (util.js:1044:20)
      at Server.setupListenHandle [as _listen2] (net.js:1367:14)
      at listenInCluster (net.js:1408:12)
      at Server.listen (net.js:1492:7)
      at Function.server.listen (/Users/jankoenig/Jovo/BundleTest/node_modules/jovo-framework/src/server.ts:17:21)
      at Object.<anonymous> (/Users/jankoenig/Jovo/BundleTest/src/index.js:15:13)
      at Module._compile (module.js:652:30)
      at Object.Module._extensions..js (module.js:663:10)
      at Module.load (module.js:565:32)
  
   ----------------------------------------------------------------------

I agree that it could have a more descriptive error message.

Are you seeing this error?

jankoenig avatar Jul 09 '19 14:07 jankoenig

Hi @jankoenig

Thanks for the speedy response promising to see that this repo is so active

A useful bit of info i probably missed out is that the port clash was caused by a create-react-app running using yarn start

Once I run jovo run I get this:

This is your webhook url: https://webhook.jovo.cloud/7c1c1143-6295-48a2-a51b-b5a8e3d94520
Local server listening on port 3000!

To open Jovo Debugger in your browser, enter .

Then when I try to launch the app through alexa testing console I get the following output

Local server did not return a valid JSON response:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Error</title>
</head>
<body>
<pre>Cannot POST /webhook</pre>
</body>
</html>

Local server did not return a valid JSON response:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Error</title>
</head>
<body>
<pre>Cannot POST /webhook</pre>
</body>
</html>

stuart-clark-45 avatar Jul 09 '19 14:07 stuart-clark-45

Hey @stuart-clark-45

Based on your feedback, we've made some improvements. Please update your Jovo CLI and let me know what you think.

aswetlow avatar Jul 17 '19 19:07 aswetlow

Hi @aswetlow,

I have updated my jovo-cli and just gave this a test afraid I see no change

stuart-clark-45 avatar Jul 29 '19 10:07 stuart-clark-45

Closing this for now due to inactivity. If the issue still persists, feel free to reopen.

rubenaeg avatar Oct 16 '20 13:10 rubenaeg

I'm facing a similar issue. When the JOVO_PORT environment variable is set to anything other than 3000, then the requests coming from Alexa and Google Actions through the Jovo Webhook fail to find the server. And then I get this very cryptic message from Node:

Local server did not return a valid JSON response:
undefined

Notice that if I use --port to change the port —rather than relying on the JOVO_PORT environment variable— then the requests from the Jovo webhook do find my local server.

mig82 avatar Jun 21 '21 12:06 mig82

Seems like this is a bug we didn't catch earlier. Setting JOVO_PORT directly does change the port for the Jovo instance, but not for the connected socket for the webhook. Will fix this with the new release for v3.

rubenaeg avatar Jun 22 '21 12:06 rubenaeg