Skip to content

TypeError: Cannot read properties of undefined (reading 'body') #264

@sarink

Description

@sarink

I can't seem to make this module work at all

// index.js
const ngrok = require('ngrok');
ngrok.connect().then(console.log);
$ node index.js

  TypeError: Cannot read properties of undefined (reading 'body')
    at NgrokClient.request (/Users/sarink/Projects/ngrok-doesnt-start-example/node_modules/ngrok/src/client.js:40:26)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async connectRetry (/Users/sarink/Projects/ngrok-doesnt-start-example/node_modules/ngrok/index.js:29:22)

I tried digging through the source to reveal the real error (#229), which is apparently ECONNREFUSED

After some more digging, I found #138 which led me to look at my auth token (in my actual app where I'm using this I set an auth token, but in the sample demo repo I made to test this issue, I did not).

That's when I noticed a ~/.ngrok/asdfasdf-some-guid-asdfasf.zip file - what is this? Whatever script wrote this presumably also is what moved my original ~/.ngrok folder (the one which has a config.yml that contains my auth token) to ~/.ngrok2.

rm -rf ~/.ngrok
mv ~/.ngrok2 ~/.ngrok

Fixed everything

Why did this happen?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions