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

Ngrok tunnel not starting and server crash for TypeError: Cannot read property 'body' of undefined, bad gateway and NgrokClientError: failed to start tunnel #310

Open
matthew-falcm opened this issue Jun 13, 2023 · 1 comment

Comments

@matthew-falcm
Copy link

matthew-falcm commented Jun 13, 2023

Hello, I didn't change anything on my server and code, but currently trying to redeploy it (I'm on railway on parse server) the server crashes while deploying and is showing these errors. I'm on the 4.3.3 of Ngrok

any suggestion?

Thank you

/app/node_modules/parse-server/lib/ParseServer.js:261
throw err;
^
TypeError: Cannot read properties of undefined (reading 'body')
at NgrokClient.request (/app/node_modules/ngrok/src/client.js:40:26)
at runMicrotasks ()
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async connectRetry (/app/node_modules/ngrok/index.js:29:22)
at async Server. (/app/build/index.js:57:25)
npm WARN config production Use --omit=dev instead.
> demo-parse-server-migration@1.1.0 start
> node build/index.js
_trailer: '',
finished: true,
_headerSent: true,
_closed: false,
socket: <ref *1> Socket {
connecting: false,
_hadError: false,
_parent: null,
_host: null,
_closeAfterHandlingError: false,
_readableState: ReadableState {
objectMode: false,
highWaterMark: 16384,
buffer: BufferList { head: null, tail: null, length: 0 },
length: 0,
pipes: [],
flowing: true,
ended: false,
endEmitted: false,
reading: true,
constructed: true,
sync: false,
needReadable: true,
emittedReadable: false,
readableListening: false,
resumeScheduled: false,
errorEmitted: false,
emitClose: false,
autoDestroy: true,
destroyed: false,
errored: null,
closed: false,
closeEmitted: false,
defaultEncoding: 'utf8',
awaitDrainWriters: null,
multiAwaitDrain: false,
readingMore: false,
dataEmitted: true,
decoder: null,
encoding: null,
[Symbol(kPaused)]: false
},
_events: [Object: null prototype] {
end: [Function: onReadableStreamEnd],
free: [Function: onFree],
close: [ [Function: onClose], [Function: socketCloseListener] ],
timeout: [Function: onTimeout],
agentRemove: [Function: onRemove],
error: [Function: socketErrorListener],
finish: [Function: bound onceWrapper] {
listener: [Function: destroy]
}
},
_eventsCount: 7,
_maxListeners: undefined,
_writableState: WritableState {
objectMode: false,
highWaterMark: 16384,
finalCalled: true,
needDrain: false,
ending: true,
ended: true,
finished: false,
destroyed: false,
decodeStrings: false,
defaultEncoding: 'utf8',
length: 0,
writing: false,
corked: 0,
sync: false,
bufferProcessing: false,
onwrite: [Function: bound onwrite],
writecb: null,
writelen: 0,
afterWriteTickInfo: null,
buffered: [],
bufferedIndex: 0,
allBuffers: true,
allNoop: true,
pendingcb: 1,
constructed: true,
prefinished: false,
errorEmitted: false,
emitClose: false,
autoDestroy: true,
errored: null,
closed: false,
closeEmitted: false,
[Symbol(kOnFinished)]: []
},
allowHalfOpen: false,
_sockname: null,
_pendingData: null,
_pendingEncoding: '',
server: null,
_server: null,
parser: null,
_httpMessage: [Circular *3],
_peername: { address: '127.0.0.1', family: 'IPv4', port: 4040 },
[Symbol(async_id_symbol)]: 2935,
[Symbol(kHandle)]: TCP {
reading: true,
onconnection: null,
[Symbol(owner_symbol)]: [Circular *1]
},
[Symbol(lastWriteQueueSize)]: 0,
[Symbol(timeout)]: null,
[Symbol(kBuffer)]: null,
[Symbol(kBufferCb)]: null,
[Symbol(kBufferGen)]: null,
[Symbol(kCapture)]: false,
[Symbol(kSetNoDelay)]: false,
[Symbol(kSetKeepAlive)]: false,
[Symbol(kSetKeepAliveInitialDelay)]: 0,
[Symbol(kBytesRead)]: 0,
[Symbol(kBytesWritten)]: 0,
[Symbol(RequestTimeout)]: undefined
},
_header: 'POST /api/tunnels HTTP/1.1\r\n' +
'user-agent: got (https://github.com/sindresorhus/got)\r\n' +
'content-type: application/json\r\n' +
'accept: application/json\r\n' +
'content-length: 138\r\n' +
'accept-encoding: gzip, deflate, br\r\n' +
'Host: 127.0.0.1:4040\r\n' +
'Connection: close\r\n' +
'\r\n',
_keepAliveTimeout: 0,
_onPendingData: [Function: nop],
agent: Agent {
_events: [Object: null prototype] {
free: [Function (anonymous)],
newListener: [Function: maybeEnableKeylog]
},
_eventsCount: 2,
_maxListeners: undefined,
defaultPort: 80,
protocol: 'http:',
options: [Object: null prototype] { path: null },
requests: [Object: null prototype] {},
sockets: [Object: null prototype] { '127.0.0.1:4040:': [ [Socket] ] },
freeSockets: [Object: null prototype] {},
keepAliveMsecs: 1000,
keepAlive: false,
maxSockets: Infinity,
maxFreeSockets: 256,
scheduling: 'lifo',
maxTotalSockets: Infinity,
totalSocketCount: 1,
[Symbol(kCapture)]: false
},
socketPath: undefined,
method: 'POST',
maxHeaderSize: undefined,
insecureHTTPParser: undefined,
path: '/api/tunnels',
_ended: true,
res: [Circular *2],
aborted: false,
timeoutCb: null,
upgradeOrConnect: false,
parser: null,
maxHeadersCount: null,
reusedSocket: false,
host: '127.0.0.1',
protocol: 'http:',
timings: {
start: 1686633771795,
socket: 1686633771796,
lookup: 1686633771796,
connect: 1686633771796,
secureConnect: undefined,
upload: 1686633771796,
response: 1686633771911,
end: 1686633771912,
error: undefined,
abort: undefined,
phases: {
wait: 1,
dns: 0,
tcp: 0,
tls: undefined,
request: 0,
firstByte: 115,
download: 1,
total: 117
}
},
emit: [Function (anonymous)],
[Symbol(kCapture)]: false,
[Symbol(kBytesWritten)]: 0,
[Symbol(kEndCalled)]: true,
[Symbol(kNeedDrain)]: false,
[Symbol(corked)]: 0,
[Symbol(kOutHeaders)]: [Object: null prototype] {
'user-agent': [ 'user-agent', 'got (https://github.com/sindresorhus/got)' ],
'content-type': [ 'content-type', 'application/json' ],
accept: [ 'accept', 'application/json' ],
'content-length': [ 'content-length', '138' ],
'accept-encoding': [ 'accept-encoding', 'gzip, deflate, br' ],
host: [ 'Host', '127.0.0.1:4040' ]
},
[Symbol(kUniqueHeaders)]: null,
[Symbol(reentry)]: true
},
timings: {
start: 1686633771795,
socket: 1686633771796,
lookup: 1686633771796,
connect: 1686633771796,
secureConnect: undefined,
upload: 1686633771796,
response: 1686633771911,
end: 1686633771912,
error: undefined,
abort: undefined,
phases: {
wait: 1,
dns: 0,
tcp: 0,
tls: undefined,
request: 0,
firstByte: 115,
download: 1,
total: 117
}
},
emit: [Function (anonymous)],
requestUrl: 'http://127.0.0.1:4040/api/tunnels';,
redirectUrls: [],
request: Request {
_readableState: ReadableState {
objectMode: false,
highWaterMark: 0,
buffer: BufferList { head: null, tail: null, length: 0 },
length: 0,
pipes: [],
flowing: false,
ended: true,
endEmitted: true,
reading: false,
constructed: true,
sync: false,
needReadable: false,
emittedReadable: false,
readableListening: true,
resumeScheduled: false,
errorEmitted: true,
emitClose: true,
autoDestroy: false,
destroyed: true,
errored: HTTPError: Response code 502 (Bad Gateway)
at Request. (/app/node_modules/ngrok/node_modules/got/dist/source/as-promise/index.js:118:42)
at runMicrotasks ()
at processTicksAndRejections (node:internal/process/task_queues:96:5) {
code: 'ERR_NON_2XX_3XX_RESPONSE',
timings: {
start: 1686633771795,
socket: 1686633771796,
lookup: 1686633771796,
connect: 1686633771796,
secureConnect: undefined,
upload: 1686633771796,
response: 1686633771911,
end: 1686633771912,
error: undefined,
abort: undefined,
phases: [Object]
}
},

....

closed: true,
closeEmitted: true,
[Symbol(kOnFinished)]: []
},
allowHalfOpen: true,
requestInitialized: true,
redirects: [],
retryCount: 0,
_progressCallbacks: [],
write: [Function: onLockedWrite],
end: [Function: onLockedWrite],
options: {
method: 'POST',
retry: {
calculateDelay: [Function: calculateDelay],
limit: 0,
methods: [ 'GET', 'PUT', 'HEAD', 'DELETE', 'OPTIONS', 'TRACE' ],
statusCodes: [
408, 413, 429, 500,
502, 503, 504, 521,
522, 524
],
errorCodes: [
'ETIMEDOUT',
'ECONNRESET',
'EADDRINUSE',
'ECONNREFUSED',
'EPIPE',
'ENOTFOUND',
'ENETUNREACH',
'EAI_AGAIN'
],
maxRetryAfter: Infinity
},
headers: {
'user-agent': 'got (https://github.com/sindresorhus/got)',
'content-type': 'application/json',
accept: 'application/json',
'content-length': '138',
'accept-encoding': 'gzip, deflate, br'
},
hooks: {
init: [],
beforeRequest: [],
beforeRedirect: [],
beforeRetry: [],
beforeError: [],
afterResponse: []
},
cache: undefined,
dnsCache: undefined,
decompress: true,
throwHttpErrors: true,
followRedirect: true,
isStream: false,
responseType: 'text',
resolveBodyOnly: false,
maxRedirects: 10,
prefixUrl: [Getter/Setter],
methodRewriting: true,
ignoreInvalidCookies: false,
http2: false,
allowGetBody: false,
https: undefined,
pagination: {
transform: [Function: transform],
paginate: [Function: paginate],
filter: [Function: filter],
shouldContinue: [Function: shouldContinue],
countLimit: Infinity,
backoff: 0,
requestLimit: 10000,
stackAllItems: true
},
parseJson: [Function: parseJson],
stringifyJson: [Function: stringifyJson],
cacheOptions: {},
username: '',
password: '',
url: <ref *4> URL {
[Symbol(context)]: URLContext {
flags: 400,
scheme: 'http:',
username: '',
password: '',
host: '127.0.0.1',
port: 4040,
path: [Array],
query: null,
fragment: null
},
[Symbol(query)]: URLSearchParams {
[Symbol(query)]: [],
[Symbol(context)]: [Circular *4]
}
},
shared: undefined,
cacheHeuristic: undefined,
immutableMinTimeToLive: undefined,
ignoreCargoCult: undefined,
request: undefined,
timeout: {},
agent: undefined,
[Symbol(isNormalizedAlready)]: true,
[Symbol(request)]: [Function: request]
},
requestUrl: 'http://127.0.0.1:4040/api/tunnels';,
_cannotHaveBody: false,
_noPipe: true,
[Symbol(kCapture)]: false,
[Symbol(downloadedSize)]: 103,
[Symbol(uploadedSize)]: 138,
[Symbol(serverResponsesPiped)]: Set(0) {},
[Symbol(stopReading)]: true,
[Symbol(triggerRead)]: false,
[Symbol(jobs)]: [],
[Symbol(body)]: '{"addr":1337,"authtoken":"","proto":"http","name":""}',
[Symbol(bodySize)]: 138,
[Symbol(cancelTimeouts)]: [Function: cancelTimeouts],
[Symbol(unproxyEvents)]: [Function (anonymous)],
[Symbol(request)]: <ref *3> ClientRequest {
_events: [Object: null prototype] {
abort: [Function: bound onceWrapper] {
listener: [Function: onAbort]
},

......

info: Parse LiveQuery Server started running
/app/node_modules/parse-server/lib/ParseServer.js:261
throw err;
^
NgrokClientError: failed to start tunnel
at NgrokClient.request (/app/node_modules/ngrok/src/client.js:33:23)
at runMicrotasks ()
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async connectRetry (/app/node_modules/ngrok/index.js:29:22)
at async Server. (/app/build/index.js:57:25) {
response: <ref *2> IncomingMessage {
_readableState: ReadableState {
objectMode: false,
highWaterMark: 16384,
buffer: BufferList { head: null, tail: null, length: 0 },
length: 0,
pipes: [],
flowing: false,
ended: true,
endEmitted: true,
reading: false,
constructed: true,
sync: false,
needReadable: false,
emittedReadable: false,
readableListening: true,
resumeScheduled: false,
errorEmitted: false,
emitClose: true,
autoDestroy: true,
destroyed: true,
errored: null,
closed: true,
closeEmitted: true,
defaultEncoding: 'utf8',
awaitDrainWriters: null,
multiAwaitDrain: false,
readingMore: false,
dataEmitted: true,
decoder: null,
encoding: null,
[Symbol(kPaused)]: null
},
_events: [Object: null prototype] {
end: [Function: responseOnEnd],
aborted: [
[Function: bound onceWrapper] { listener: [Function: onAbort] },
[Function: bound onceWrapper] {
listener: [Function (anonymous)]
}
],
error: [Function: bound onceWrapper] { listener: [Function (anonymous)] },
readable: [Function (anonymous)]
},
_eventsCount: 4,
_maxListeners: undefined,
socket: <ref *1> Socket {
connecting: false,
_hadError: false,
_parent: null,
_host: null,
_closeAfterHandlingError: false,
_readableState: ReadableState {
objectMode: false,
highWaterMark: 16384,
buffer: BufferList { head: null, tail: null, length: 0 },
length: 0,
pipes: [],
flowing: true,
ended: false,
endEmitted: false,
reading: true,
constructed: true,
sync: false,
needReadable: true,
emittedReadable: false,
readableListening: false,
resumeScheduled: false,
errorEmitted: false,
emitClose: false,
autoDestroy: true,
destroyed: false,
errored: null,
closed: false,
closeEmitted: false,
defaultEncoding: 'utf8',
awaitDrainWriters: null,
multiAwaitDrain: false,
readingMore: false,
dataEmitted: true,
decoder: null,
encoding: null,
[Symbol(kPaused)]: false
},
_events: [Object: null prototype] {
end: [Function: onReadableStreamEnd],
free: [Function: onFree],
close: [ [Function: onClose], [Function: socketCloseListener] ],
timeout: [Function: onTimeout],
agentRemove: [Function: onRemove],
error: [Function: socketErrorListener],
finish: [Function: bound onceWrapper] { listener: [Function: destroy] }
},
_eventsCount: 7,
_maxListeners: undefined,
_writableState: WritableState {
objectMode: false,
highWaterMark: 16384,
finalCalled: true,
needDrain: false,
ending: true,
ended: true,
finished: false,
destroyed: false,
decodeStrings: false,
defaultEncoding: 'utf8',
length: 0,
writing: false,
corked: 0,
sync: false,
bufferProcessing: false,
onwrite: [Function: bound onwrite],
writecb: null,
writelen: 0,
afterWriteTickInfo: null,
buffered: [],
bufferedIndex: 0,
allBuffers: true,
allNoop: true,
pendingcb: 1,
constructed: true,
prefinished: false,
errorEmitted: false,
emitClose: false,
autoDestroy: true,
errored: null,
closed: false,
closeEmitted: false,
[Symbol(kOnFinished)]: []
},
allowHalfOpen: false,
_sockname: null,
_pendingData: null,
_pendingEncoding: '',
server: null,
_server: null,
parser: null,
_httpMessage: ClientRequest {
_events: [Object: null prototype] {
abort: [Function: bound onceWrapper] {
listener: [Function: onAbort]
},
socket: [Function (anonymous)],
error: [ [Function], [Function] ],
close: [Function: bound onceWrapper] {
listener: [Function: cancelTimeouts]
},
connect: [Function (anonymous)],
continue: [Function (anonymous)],
information: [Function (anonymous)],
upgrade: [Function (anonymous)],
timeout: [Function (anonymous)],
finish: [Function: requestOnFinish]
},

.... repeated

@SpainTrain
Copy link

For anyone who comes upon this, we had to update to 5.0.0-beta.2 to fix this issue.

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