ngrok
ngrok copied to clipboard
4.x fails to start ngrok process
Using 3.4.1 has no problems, after upgrading to 4.0.1 the below error output happens.
Usage
ngrok
.connect({
proto: "http",
authtoken: process.env.NGROK_AUTH_TOKEN,
addr: 8080,
region: process.env.NGROK_REGION,
hostname: process.env.FLYPAPER_API_URL.replace("https://", "")
})
.then((url) => {
console.log("NGROK URL: " + url)
})
.catch((err) => {
console.error(err)
process.exit(1)
})
Error Log
[ngrok 11:49:45] NgrokClientError
[ngrok 11:49:45] at NgrokClient.request (REDACTED/node_modules/ngrok/src/client.js:39:23)
[ngrok 11:49:45] at processTicksAndRejections (internal/process/task_queues.js:97:5)
[ngrok 11:49:45] at async connectRetry (REDACTED/node_modules/ngrok/index.js:29:22) {
[ngrok 11:49:45] response: <ref *1> IncomingMessage {
[ngrok 11:49:45] _readableState: ReadableState {
[ngrok 11:49:45] objectMode: false,
[ngrok 11:49:45] highWaterMark: 16384,
[ngrok 11:49:45] buffer: BufferList { head: null, tail: null, length: 0 },
[ngrok 11:49:45] length: 0,
[ngrok 11:49:45] pipes: [],
[ngrok 11:49:45] flowing: false,
[ngrok 11:49:45] ended: true,
[ngrok 11:49:45] endEmitted: true,
[ngrok 11:49:45] reading: false,
[ngrok 11:49:45] sync: false,
[ngrok 11:49:45] needReadable: false,
[ngrok 11:49:45] emittedReadable: false,
[ngrok 11:49:45] readableListening: true,
[ngrok 11:49:45] resumeScheduled: false,
[ngrok 11:49:45] errorEmitted: false,
[ngrok 11:49:45] emitClose: true,
[ngrok 11:49:45] autoDestroy: false,
[ngrok 11:49:45] destroyed: false,
[ngrok 11:49:45] errored: false,
[ngrok 11:49:45] closed: false,
[ngrok 11:49:45] defaultEncoding: ‘utf8’,
[ngrok 11:49:45] awaitDrainWriters: null,
[ngrok 11:49:45] multiAwaitDrain: false,
[ngrok 11:49:45] readingMore: false,
[ngrok 11:49:45] decoder: [StringDecoder],
[ngrok 11:49:45] encoding: ‘utf8’,
[ngrok 11:49:45] [Symbol(kPaused)]: null
[ngrok 11:49:45] },
[ngrok 11:49:45] _events: [Object: null prototype] {
[ngrok 11:49:45] end: [Array],
[ngrok 11:49:45] error: [Array],
[ngrok 11:49:45] aborted: [Array],
[ngrok 11:49:45] readable: [Array],
[ngrok 11:49:45] finish: [Function: onfinish],
[ngrok 11:49:45] close: [Function: onclose]
[ngrok 11:49:45] },
[ngrok 11:49:45] _eventsCount: 6,
[ngrok 11:49:45] _maxListeners: undefined,
[ngrok 11:49:45] socket: Socket {
[ngrok 11:49:45] connecting: false,
[ngrok 11:49:45] _hadError: false,
[ngrok 11:49:45] _parent: null,
[ngrok 11:49:45] _host: null,
[ngrok 11:49:45] _readableState: [ReadableState],
[ngrok 11:49:45] _events: [Object: null prototype],
[ngrok 11:49:45] _eventsCount: 7,
[ngrok 11:49:45] _maxListeners: undefined,
[ngrok 11:49:45] _writableState: [WritableState],
[ngrok 11:49:45] allowHalfOpen: false,
[ngrok 11:49:45] _sockname: null,
[ngrok 11:49:45] _pendingData: null,
[ngrok 11:49:45] _pendingEncoding: ‘’,
[ngrok 11:49:45] server: null,
[ngrok 11:49:45] _server: null,
[ngrok 11:49:45] parser: null,
[ngrok 11:49:45] _httpMessage: [ClientRequest],
[ngrok 11:49:45] _peername: [Object],
[ngrok 11:49:45] [Symbol(asyncId)]: 28,
[ngrok 11:49:45] [Symbol(kHandle)]: [TCP],
[ngrok 11:49:45] [Symbol(kSetNoDelay)]: false,
[ngrok 11:49:45] [Symbol(lastWriteQueueSize)]: 0,
[ngrok 11:49:45] [Symbol(timeout)]: null,
[ngrok 11:49:45] [Symbol(kBuffer)]: null,
[ngrok 11:49:45] [Symbol(kBufferCb)]: null,
[ngrok 11:49:45] [Symbol(kBufferGen)]: null,
[ngrok 11:49:45] [Symbol(kCapture)]: false,
[ngrok 11:49:45] [Symbol(kBytesRead)]: 0,
[ngrok 11:49:45] [Symbol(kBytesWritten)]: 0
[ngrok 11:49:45] },
[ngrok 11:49:45] httpVersionMajor: 1,
[ngrok 11:49:45] httpVersionMinor: 1,
[ngrok 11:49:45] httpVersion: ‘1.1’,
[ngrok 11:49:45] complete: true,
[ngrok 11:49:45] headers: {
[ngrok 11:49:45] ‘content-type’: ‘application/json’,
[ngrok 11:49:45] date: ‘Mon, 03 May 2021 15:49:45 GMT’,
[ngrok 11:49:45] ‘content-length’: ‘168’,
[ngrok 11:49:45] connection: ‘close’
[ngrok 11:49:45] },
[ngrok 11:49:45] rawHeaders: [
[ngrok 11:49:45] ‘Content-Type’,
[ngrok 11:49:45] ‘application/json’,
[ngrok 11:49:45] ‘Date’,
[ngrok 11:49:45] ‘Mon, 03 May 2021 15:49:45 GMT’,
[ngrok 11:49:45] ‘Content-Length’,
[ngrok 11:49:45] ‘168’,
[ngrok 11:49:45] ‘Connection’,
[ngrok 11:49:45] ‘close’
[ngrok 11:49:45] ],
[ngrok 11:49:45] trailers: {},
[ngrok 11:49:45] rawTrailers: [],
[ngrok 11:49:45] aborted: false,
[ngrok 11:49:45] upgrade: false,
[ngrok 11:49:45] url: ‘http://127.0.0.1:4040/api/tunnels’,
[ngrok 11:49:45] method: null,
[ngrok 11:49:45] statusCode: 503,
[ngrok 11:49:45] statusMessage: ‘Service Unavailable’,
[ngrok 11:49:45] client: Socket {
[ngrok 11:49:45] connecting: false,
[ngrok 11:49:45] _hadError: false,
[ngrok 11:49:45] _parent: null,
[ngrok 11:49:45] _host: null,
[ngrok 11:49:45] _readableState: [ReadableState],
[ngrok 11:49:45] _events: [Object: null prototype],
[ngrok 11:49:45] _eventsCount: 7,
[ngrok 11:49:45] _maxListeners: undefined,
[ngrok 11:49:45] _writableState: [WritableState],
[ngrok 11:49:45] allowHalfOpen: false,
[ngrok 11:49:45] _sockname: null,
[ngrok 11:49:45] _pendingData: null,
[ngrok 11:49:45] _pendingEncoding: ‘’,
[ngrok 11:49:45] server: null,
[ngrok 11:49:45] _server: null,
[ngrok 11:49:45] parser: null,
[ngrok 11:49:45] _httpMessage: [ClientRequest],
[ngrok 11:49:45] _peername: [Object],
[ngrok 11:49:45] [Symbol(asyncId)]: 28,
[ngrok 11:49:45] [Symbol(kHandle)]: [TCP],
[ngrok 11:49:45] [Symbol(kSetNoDelay)]: false,
[ngrok 11:49:45] [Symbol(lastWriteQueueSize)]: 0,
[ngrok 11:49:45] [Symbol(timeout)]: null,
[ngrok 11:49:45] [Symbol(kBuffer)]: null,
[ngrok 11:49:45] [Symbol(kBufferCb)]: null,
[ngrok 11:49:45] [Symbol(kBufferGen)]: null,
[ngrok 11:49:45] [Symbol(kCapture)]: false,
[ngrok 11:49:45] [Symbol(kBytesRead)]: 0,
[ngrok 11:49:45] [Symbol(kBytesWritten)]: 0
[ngrok 11:49:45] },
[ngrok 11:49:45] _consuming: true,
[ngrok 11:49:45] _dumped: false,
[ngrok 11:49:45] req: ClientRequest {
[ngrok 11:49:45] _events: [Object: null prototype],
[ngrok 11:49:45] _eventsCount: 10,
[ngrok 11:49:45] _maxListeners: undefined,
[ngrok 11:49:45] outputData: [],
[ngrok 11:49:45] outputSize: 0,
[ngrok 11:49:45] writable: true,
[ngrok 11:49:45] destroyed: false,
[ngrok 11:49:45] _last: true,
[ngrok 11:49:45] chunkedEncoding: false,
[ngrok 11:49:45] shouldKeepAlive: false,
[ngrok 11:49:45] useChunkedEncodingByDefault: true,
[ngrok 11:49:45] sendDate: false,
[ngrok 11:49:45] _removedConnection: false,
[ngrok 11:49:45] _removedContLen: false,
[ngrok 11:49:45] _removedTE: false,
[ngrok 11:49:45] _contentLength: null,
[ngrok 11:49:45] _hasBody: true,
[ngrok 11:49:45] _trailer: ‘’,
[ngrok 11:49:45] finished: true,
[ngrok 11:49:45] _headerSent: true,
[ngrok 11:49:45] socket: [Socket],
[ngrok 11:49:45] _header: ‘POST /api/tunnels HTTP/1.1\r\n’ +
[ngrok 11:49:45] ‘user-agent: got (https://github.com/sindresorhus/got)\r\n’ +
[ngrok 11:49:45] ‘content-type: application/json\r\n’ +
[ngrok 11:49:45] ‘accept: application/json\r\n’ +
[ngrok 11:49:45] ‘content-length: 186\r\n’ +
[ngrok 11:49:45] ‘accept-encoding: gzip, deflate, br\r\n’ +
[ngrok 11:49:45] ‘Host: 127.0.0.1:4040\r\n’ +
[ngrok 11:49:45] ‘Connection: close\r\n’ +
[ngrok 11:49:45] ‘\r\n’,
[ngrok 11:49:45] _onPendingData: [Function: noopPendingOutput],
[ngrok 11:49:45] agent: [Agent],
[ngrok 11:49:45] socketPath: undefined,
[ngrok 11:49:45] method: ‘POST’,
[ngrok 11:49:45] maxHeaderSize: undefined,
[ngrok 11:49:45] insecureHTTPParser: undefined,
[ngrok 11:49:45] path: ‘/api/tunnels’,
[ngrok 11:49:45] _ended: true,
[ngrok 11:49:45] res: [Circular *1],
[ngrok 11:49:45] aborted: false,
[ngrok 11:49:45] timeoutCb: null,
[ngrok 11:49:45] upgradeOrConnect: false,
[ngrok 11:49:45] parser: null,
[ngrok 11:49:45] maxHeadersCount: null,
[ngrok 11:49:45] reusedSocket: false,
[ngrok 11:49:45] timings: [Object],
[ngrok 11:49:45] emit: [Function (anonymous)],
[ngrok 11:49:45] [Symbol(kCapture)]: false,
[ngrok 11:49:45] [Symbol(kNeedDrain)]: false,
[ngrok 11:49:45] [Symbol(corked)]: 0,
[ngrok 11:49:45] [Symbol(kOutHeaders)]: [Object: null prototype],
[ngrok 11:49:45] [Symbol(reentry)]: true
[ngrok 11:49:45] },
[ngrok 11:49:45] timings: {
[ngrok 11:49:45] start: 1620056985653,
[ngrok 11:49:45] socket: 1620056985656,
[ngrok 11:49:45] lookup: 1620056985657,
[ngrok 11:49:45] connect: 1620056985657,
[ngrok 11:49:45] secureConnect: undefined,
[ngrok 11:49:45] upload: 1620056985657,
[ngrok 11:49:45] response: 1620056985659,
[ngrok 11:49:45] end: 1620056985662,
[ngrok 11:49:45] error: undefined,
[ngrok 11:49:45] abort: undefined,
[ngrok 11:49:45] phases: [Object]
[ngrok 11:49:45] },
[ngrok 11:49:45] emit: [Function (anonymous)],
[ngrok 11:49:45] requestUrl: ‘http://127.0.0.1:4040/api/tunnels’,
[ngrok 11:49:45] redirectUrls: [],
[ngrok 11:49:45] request: Request {
[ngrok 11:49:45] _readableState: [ReadableState],
[ngrok 11:49:45] _events: [Object: null prototype],
[ngrok 11:49:45] _eventsCount: 16,
[ngrok 11:49:45] _maxListeners: undefined,
[ngrok 11:49:45] _writableState: [WritableState],
[ngrok 11:49:45] allowHalfOpen: true,
[ngrok 11:49:45] requestInitialized: true,
[ngrok 11:49:45] redirects: [],
[ngrok 11:49:45] retryCount: 0,
[ngrok 11:49:45] _progressCallbacks: [],
[ngrok 11:49:45] write: [Function: onLockedWrite],
[ngrok 11:49:45] end: [Function: onLockedWrite],
[ngrok 11:49:45] options: [Object],
[ngrok 11:49:45] requestUrl: ‘http://127.0.0.1:4040/api/tunnels’,
[ngrok 11:49:45] _cannotHaveBody: false,
[ngrok 11:49:45] _noPipe: true,
[ngrok 11:49:45] [Symbol(kCapture)]: false,
[ngrok 11:49:45] [Symbol(downloadedSize)]: 168,
[ngrok 11:49:45] [Symbol(uploadedSize)]: 186,
[ngrok 11:49:45] [Symbol(serverResponsesPiped)]: Set(0) {},
[ngrok 11:49:45] [Symbol(stopReading)]: true,
[ngrok 11:49:45] [Symbol(triggerRead)]: false,
[ngrok 11:49:45] [Symbol(jobs)]: [],
[ngrok 11:49:45] [Symbol(body)]: ‘{“proto”:“http”,“authtoken”:“REDACTED”,“addr”:8080,“region”:“us”,“hostname”:“REDACTED”,“name”:“e776b7ab-c22c-4973-89d0-0f8fb423b2d0”}’,
[ngrok 11:49:45] [Symbol(bodySize)]: 186,
[ngrok 11:49:45] [Symbol(cancelTimeouts)]: [Function: cancelTimeouts],
[ngrok 11:49:45] [Symbol(unproxyEvents)]: [Function (anonymous)],
[ngrok 11:49:45] [Symbol(request)]: [ClientRequest],
[ngrok 11:49:45] [Symbol(originalResponse)]: [Circular *1],
[ngrok 11:49:45] [Symbol(isFromCache)]: false,
[ngrok 11:49:45] [Symbol(responseSize)]: 168,
[ngrok 11:49:45] [Symbol(response)]: [Circular *1],
[ngrok 11:49:45] [Symbol(startedReading)]: true
[ngrok 11:49:45] },
[ngrok 11:49:45] isFromCache: false,
[ngrok 11:49:45] ip: ‘127.0.0.1’,
[ngrok 11:49:45] retryCount: 0,
[ngrok 11:49:45] rawBody: <Buffer >,
[ngrok 11:49:45] body: ‘’,
[ngrok 11:49:45] [Symbol(kCapture)]: false
[ngrok 11:49:45] },
[ngrok 11:49:45] body: ‘’
[ngrok 11:49:45] }
[ngrok 11:49:45] node ./scripts/dist/ngrok
Thanks for raising this @Logikgate. That is bizarre that the previous version worked and this one didn't though. The internal API call being made is the same, even if the HTTP client has changed.
I will do some testing to see if I can reproduce it. Can I confirm that if you downgrade the version that it still works?
Yep I can confirm that after downgrading everything worked again
Apologies, I've not had the time to reproduce this yet and I won't for the next couple of weeks. I suspect one of the options you are passing is causing some difficulty, but I don't know which one.
If you are able to look into this further, I'd appreciate any more insights. Otherwise I'm happy that you can hold on version 3.4.1 for now and I will get back to this when I return in a couple of weeks.
Hey @BvdLind, I don't think this is the issue. Got only requires Node 15.10.0
for HTTP/2 support and Got version 11 supports Node >=10.19.0
.
Okay yeah nevermind. I get the error on node version 14.1.0
and below, but on versions 14.2.0
and above it does work.
I think it at least requires a mention for the time being in the readme, since you would assume from the readme that node version >=10.19.0
would work for version >=4
.
It's interesting that different versions of Node work or don't work for you with this. That's something I can add into trying to find out what is going on here. It really should work for Node 14.1.0 and below, so this is an issue!
Looks like I'm having the same issue (4.0.1 fails @ node 14.1.0 and works @ 15.14.0; I haven't narrowed the version barrier yet). I wonder if node packages may have some field indicating minimal node version that's supported...
OK, downgrading my version of Node to 14.1.0 has lead to some different issues. My tunnel still connects, but this module does not return the URL as expected. Definitely some more to investigate here.
PS I've googled what I've asked about and it may be it's worth bumping engines
of the package
As far as I can tell, this is a Node bug for versions 14 and 14.1 that affects got. Anything under 14 or 14.2 and over is not affected.
I have updated the engines
property in package.json
to ">=10.19.0 <14 || >=14.2"
.
Can anyone experiencing this please test ngrok
with Node version 14.2 or greater and let me know if it works for you or if there are still issues?
@Logikgate you originally reported this, what version of Node were you using?
Thanks!
I don't know if this is helpful, but I had a very similar issue, where the status message was Service Unavailable
(figured that out with #231).
In my case the issue was that I already opened a tunnel with a specified region
and was trying to open another one for the same region. Using a different region for the second tunnel it worked without throwing an error.
I'm going to close this as fixed with the update to the engines property.