Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
2 of 4 tasks
stuart-clark-45 opened this issue Jul 9, 2019 · 7 comments
Open
2 of 4 tasks
Labels
Bug v3 Issues/PRs for v3 of the Jovo CLI

Comments

@stuart-clark-45
Copy link

I'm submitting a...

  • Bug report
  • 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 stuart-clark-45 changed the title jovo run should throw an error if selected default port is already being used "jovo run" should throw an error if selected default port is already being used Jul 9, 2019
@jankoenig
Copy link
Member

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?

@stuart-clark-45
Copy link
Author

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>

@aswetlow
Copy link
Member

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.

@stuart-clark-45
Copy link
Author

Hi @aswetlow,

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

@rubenaeg
Copy link
Contributor

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

@mig82
Copy link

mig82 commented Jun 21, 2021

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.

@rubenaeg rubenaeg reopened this Jun 22, 2021
@rubenaeg
Copy link
Contributor

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 rubenaeg added Bug v3 Issues/PRs for v3 of the Jovo CLI labels Jun 22, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug v3 Issues/PRs for v3 of the Jovo CLI
Projects
None yet
Development

No branches or pull requests

5 participants