question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Request timeout error when deployed in heroku.

See original GitHub issue

It works like a charm when I am running the project in localhost. But when I deployed my project in Heroku it is showing a timeout error 503.

My code:

FtpRoutes.js

const Ftp = require('./ftpclient')

 router.get("/root",(req,res)=> {
    const rootclient = new Ftp("192.168.0.4", 2121, "ftp", "ftp");
    console.log('reached root method');
    rootclient.rootFolder().then((result) => {
        res.send(result);
    });
})

ftpclient.js

class FTPClient {
    constructor(host, port, username, password, secure = false) {
        this.client = new ftp.Client();
        this.path = '/'
        this.settings = {
            host: host,
            port: port,
            user: username,
            password: password,
            secure: secure
        };
    }

    // List operation
    async rootFolder() {
        let res = null
        try {
            res = await Lists.parentList(this.client, this.settings);
        }
        catch (err) {
            console.log(err);
        }
        return res;
    }

Heroku Log:

at=error code=H12 desc="Request timeout" method=GET path="/root" host=nowires.herokuapp.com request_id=5bbdc647-9f8e-4097-84a1-56e9612b8572 fwd="183.83.255.74" dyno=web.1 connect=0ms service=30000ms status=503 bytes=0 protocol=https

GET /root - - - - ms
 Error: Timeout (control socket)
 at Socket.<anonymous> (/app/node_modules/basic-ftp/dist/FtpContext.js:316:58)
 at Object.onceWrapper (events.js:421:28)
 at Socket.emit (events.js:315:20)
 at Socket._onTimeout (net.js:483:8)
 at listOnTimeout (internal/timers.js:554:17)
 at processTimers (internal/timers.js:497:7)

image

Note: It is working instantly when I am in localhost.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
mofuxcommented, Mar 23, 2021

I’m pretty sure it’s failing because the IP (192.168.0.4) won’t be reachable from your Heroku host. The Heroku host is a public hosting and does not have access to your internal IP subnet.

0reactions
patrickjuchlicommented, Mar 24, 2021

Don’t use this issue tracker for problems unrelated to this library.

Your question seems to be why using “192.168.0.4” on a public server means something else than on your own computer. This is a question for e.g. Stackoverflow and I’m sure you’ll get your answers there.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Request Timeout | Heroku Dev Center
One cause of request timeouts is an infinite loop in the code. Test locally (perhaps using a local copy of the production database,...
Read more >
Preventing H12 Errors (Request Timeouts) - Heroku Dev Center
H12 errors occur when an HTTP request takes longer than 30 seconds to complete. These errors are often caused by: Long-running requests, such ......
Read more >
Addressing H12 Errors (Request Timeouts) - Heroku Dev Center
These errors occur when an HTTP request takes longer than 30 seconds to complete. They're often caused by: Long-running requests, such as ...
Read more >
Why am I getting "H12 Request timeout" errors in NodeJS?
With H12 - Request Timeout errors, we generally see this pattern where one long-running action starts hogging the queue which in turn affects...
Read more >
Heroku Error Codes
Table of Contents. H10 - App crashed; H11 - Backlog too deep; H12 - Request timeout; H13 - Connection closed without response; H14...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found