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

Server works when using up start but gets error: "waiting to be in listening state" on staging enviroment #805

Open
3 of 4 tasks
seve opened this issue Mar 19, 2020 · 4 comments

Comments

@seve
Copy link

seve commented Mar 19, 2020

Prerequisites

  • I am running the latest version. (up upgrade)
  • I searched to see if the issue already exists.
  • I inspected the verbose debug output with the -v, --verbose flag.
  • Are you an Up Pro subscriber?

Description

After deploying my Prisma server using up I get this error when I navigate to the deployed URL: {"message": "Internal server error"} when checking logs I see the following

  Mar 19th 01:39:26pm INFO staging 5e3a8b1 initializing
  Mar 19th 01:39:26pm INFO staging 5e3a8b1 starting app: PORT=35343 command=ts-node index.ts
  Mar 19th 01:39:26pm INFO staging 5e3a8b1 started app
  Mar 19th 01:39:26pm INFO staging 5e3a8b1 waiting for app to listen on PORT
  Mar 19th 01:39:41pm FATA staging 5e3a8b1 error creating handler: waiting for http://127.0.0.1:35343 to be in listening state: timed out after 15s: name=tracket-server type=server
  Mar 19th 01:39:41pm INFO 2020-03-19T20:39:41.086Z     d104c092-c99a-434a-a700-9adc30841dfe    ERROR   [shim] exit: code=1 signal=null
     2.121s   Mar 19th 01:39:41pm INFO REPORT RequestId: d104c092-c99a-434a-a700-9adc30841dfe   Duration: 15134.81 ms   Billed Duration: 15200 ms       Memory Size: 512 MB     Max Memory Used: 182 MB
 DEBU request  Mar 19th 01:39:41pm INFO RequestId: d104c092-c99a-434a-a700-9adc30841dfe Error: Runtime exited with error: exit status 1
Runtime.ExitError

However when running the deployment server using up start -v I get a working server and the following output in my console:

   ⠋ 7ms     DEBU up version 1.5.1 (os: darwin, arch: amd64)  Mar 19th 01:41:49pm DEBU inferred runtime: type=node
  Mar 19th 01:41:49pm DEBU 1 regions from config
  Mar 19th 01:41:49pm DEBU track "Start" map[address:localhost:3000 arch:amd64 ci:false has_command:false os:darwin version:1.5.1]
  Mar 19th 01:41:49pm INFO starting app: PORT=63980 command=ts-node index.ts
  Mar 19th 01:41:49pm INFO started app
  Mar 19th 01:41:49pm INFO waiting for app to listen on PORT
   ⠸ 8.403s  DEBU up version 1.5.1 (os: darwin, arch: amd64)  Mar 19th 01:41:58pm INFO Server is running on http://localhost:63980
   ⠋ 9.101s  DEBU up version 1.5.1 (os: darwin, arch: amd64)  Mar 19th 01:41:59pm INFO app listening: duration=9.098s
  Mar 19th 01:41:59pm DEBU header rules from _headers file: 0
  Mar 19th 01:41:59pm DEBU header rules from up.json: 0
  Mar 19th 01:41:59pm INFO listening: address=http://localhost:3000
   ⠸ 26.401s DEBU up version 1.5.1 (os: darwin, arch: amd64)  Mar 19th 01:42:16pm INFO request: ip=127.0.0.1:64053 method=GET path=/
  Mar 19th 01:42:16pm INFO response: duration=23ms ip=127.0.0.1:64053 method=GET path=/ size=3.0 kB status=200
   ⠼ 28.501s DEBU up version 1.5.1 (os: darwin, arch: amd64)  Mar 19th 01:42:18pm INFO request: ip=127.0.0.1:64060 method=POST path=/ size=1.5 kB

Repo: https://github.com/tracket-dev/tracket-server

@tj
Copy link
Member

tj commented Mar 20, 2020

are you connecting to a database before calling listen(PORT)? Maybe there's a permission issue preventing it from getting there, the "waiting to be in listening state" means your app isn't listening on the port provided by the PORT env var.

It might be useful to throw a few console.log()s in your app to see if it gets stuck before reaching listen()

@seve
Copy link
Author

seve commented Mar 21, 2020

@tj Thanks for the help! After throwing some logs into the app, I'm seeing that it never enters index.ts on the staging server. However on the local development server, I see the logging.

@tj
Copy link
Member

tj commented Mar 23, 2020

Up uses app.js as the default for Node.js, but it'll use npm start's script if you have that. Just a guess but maybe package.json is in .upignore? That could prevent it from using the correct command.

Alternatively you could try:

{
  "proxy": {
    "command": "node index.js"
  }
}

To make it explicit. It should error though if it can't find app.js, so I might be wrong about that

@seve
Copy link
Author

seve commented Mar 24, 2020

I don't have a .upignore in my project so that's not the issue. I just added my start command (ts-node index.ts to my config and its still resulting in the same thing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants