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

Functions succesfuly making api request in emulator and not working when deployed #1617

Open
saidElhadi opened this issue Sep 17, 2024 · 1 comment

Comments

@saidElhadi
Copy link

saidElhadi commented Sep 17, 2024

Related issues

None

[REQUIRED] Version info

**node:**20

plan: blaze

**firebase-functions:**5.0.1

**firebase-tools:**13.14.1

**firebase-admin:**11.8.0

[REQUIRED] Test case

[REQUIRED] Steps to reproduce

make a function that calls an external API with post
try it in your emulator
it should work
deploy it to the cloud

[REQUIRED] Expected behavior

5/6 times get a timeout from the post request
Screenshot 2024-09-15 164301

[REQUIRED] Actual behavior

2024-09-17 12:54:22.489 HKT
request { Message: { Request: { Detail: [Object], Account: [Object] } } }
2024-09-17 12:54:22.740 HKT
TRX Response { Message: { Response: { Reference: [Object], Result: [Object], StorageSafe: [Object] } } }
2024-09-17 12:59:01.489 HKT
OPTIONS204258 B4 msChrome 128 https://us-central1-yumciti-64e70.cloudfunctions.net/processStorageSafeInsert
2024-09-17 12:59:01.722 HKT
POST200262 B319 msChrome 128 https://us-central1-yumciti-64e70.cloudfunctions.net/processStorageSafeInsert
2024-09-17 12:59:01.729 HKT
Callable request verification passed
2024-09-17 12:59:01.730 HKT
request { Message: { Request: { Detail: [Object], Account: [Object] } } }
2024-09-17 12:59:01.931 HKT
TRX Response { Message: { Response: { Reference: [Object], Result: [Object], StorageSafe: [Object] } } }
2024-09-17 13:03:05.705 HKT
OPTIONS204258 B4 msChrome 128 https://us-central1-yumciti-64e70.cloudfunctions.net/processStorageSafeInsert
2024-09-17 13:03:05.918 HKT
POST200262 B312 msChrome 128 https://us-central1-yumciti-64e70.cloudfunctions.net/processStorageSafeInsert
2024-09-17 13:03:05.925 HKT
Callable request verification passed
2024-09-17 13:03:05.925 HKT
request { Message: { Request: { Detail: [Object], Account: [Object] } } }
2024-09-17 13:03:06.107 HKT
TRX Response { Message: { Response: { Reference: [Object], Result: [Object], StorageSafe: [Object] } } }
2024-09-17 13:18:03.387 HKT
OPTIONS204258 B1 sChrome 128 https://us-central1-yumciti-64e70.cloudfunctions.net/processStorageSafeInsert
2024-09-17 13:18:04.487 HKT
Default STARTUP TCP probe succeeded after 1 attempt for container "worker" on port 8080.
2024-09-17 13:18:04.897 HKT
Callable request verification passed
2024-09-17 13:18:04.900 HKT
request { Message: { Request: { Detail: [Object], Account: [Object] } } }
2024-09-17 13:18:34.914 HKT
Error processing Storage Safe request: AxiosError: timeout of 30000ms exceeded at RedirectableRequest.handleRequestTimeout (/workspace/node_modules/axios/dist/node/axios.cjs:3193:16) at RedirectableRequest.emit (node:events:517:28) at RedirectableRequest.emit (node:domain:552:15) at Timeout.<anonymous> (/workspace/node_modules/follow-redirects/index.js:210:12) at listOnTimeout (node:internal/timers:569:17) at process.processTimers (node:internal/timers:512:7) at Axios.request (/workspace/node_modules/axios/dist/node/axios.cjs:4287:41) at async /workspace/lib/trxFunctions/processStorageSafeInsert.js:65:29 at async /workspace/node_modules/firebase-functions/lib/common/providers/https.js:467:26 { code: 'ECONNABORTED', config: { transitional: { silentJSONParsing: true, forcedJSONParsing: true, clarifyTimeoutError: false }, adapter: [ 'xhr', 'http', 'fetch' ], transformRequest: [ [Function: transformRequest] ], transformResponse: [ [Function: transformResponse] ], timeout: 30000, xsrfCookieName: 'XSRF-TOKEN', xsrfHeaderName: 'X-XSRF-TOKEN', maxContentLength: -1, maxBodyLength: -1, env: { FormData: [Function], Blob: [class Blob] }, validateStatus: [Function: validateStatus], headers: Object [AxiosHeaders] { Accept: 'application/json, text/plain, */*', 'Content-Type': 'application/json', Authorization: 'Basic MDAwODIzXzAwMDAwMjowNTU3MDM3ODQ2NzBEREU1NTZBQUUzODM5RkFCMUU3RQ==', 'User-Agent': 'axios/1.7.7', 'Content-Length': '156', 'Accept-Encoding': 'gzip, compress, deflate, br' }, method: 'post', url: 'https://gateway.trxservices.net/json', data: '{"Message":{"Request":{"Detail":{"TranType":"StorageSafe","TranAction":"Insert"},"Account":{"Expiration":"1234","Pan":"5555555555554444","Postal":"1234"}}}}' }, request: <ref *1> Writable { _writableState: WritableState { objectMode: false, highWaterMark: 16384, finalCalled: false, needDrain: false, ending: false, ended: false, finished: false, destroyed: false, decodeStrings: true, defaultEncoding: 'utf8', length: 0, writing: false, corked: 0, sync: true, bufferProcessing: false, onwrite: [Function: bound onwrite], writecb: null, writelen: 0, afterWriteTickInfo: null, buffered: [], bufferedIndex: 0, allBuffers: true, allNoop: true, pendingcb: 0, constructed: true, prefinished: false, errorEmitted: false, emitClose: true, autoDestroy: true, errored: null, closed: false, closeEmitted: false, [Symbol(kOnFinished)]: [] }, _events: [Object: null prototype] { response: [Function: handleResponse], error: [Function: handleRequestError], socket: [Array] }, _eventsCount: 3, _maxListeners: undefined, _options: { maxRedirects: 21, maxBodyLength: Infinity, protocol: 'https:', path: '/json', method: 'POST', headers: [Object: null prototype], agents: [Object], auth: undefined, family: undefined, beforeRedirect: [Function: dispatchBeforeRedirect], beforeRedirects: [Object], hostname: 'gateway.trxservices.net', port: '', agent: undefined, nativeProtocols: [Object], pathname: '/json' }, _ended: false, _ending: true, _redirectCount: 0, _redirects: [], _requestBodyLength: 156, _requestBodyBuffers: [ [Object] ], _onNativeResponse: [Function (anonymous)], _currentRequest: ClientRequest { _events: [Object: null prototype], _eventsCount: 7, _maxListeners: undefined, outputData: [], outputSize: 0, writable: true, destroyed: false, _last: true, chunkedEncoding: false, shouldKeepAlive: false, maxRequestsOnConnectionReached: false, _defaultKeepAlive: true, useChunkedEncodingByDefault: true, sendDate: false, _removedConnection: false, _removedContLen: false, _removedTE: false, strictContentLength: false, _contentLength: '156', _hasBody: true, _trailer: '', finished: false, _headerSent: true, _closed: false, socket: [TLSSocket], _header: 'POST /json HTTP/1.1\r\n' + 'Accept: application/json, text/plain, */*\r\n' + 'Content-Type: application/json\r\n' + 'Authorization: Basic MDAwODIzXzAwMDAwMjowNTU3MDM3ODQ2NzBEREU1NTZBQUUzODM5RkFCMUU3RQ==\r\n' + 'User-Agent: axios/1.7.7\r\n' + 'Content-Length: 156\r\n' + 'Accept-Encoding: gzip, compress, deflate, br\r\n' + 'Host: gateway.trxservices.net\r\n' + 'Connection: close\r\n' + '\r\n', _keepAliveTimeout: 0, _onPendingData: [Function: nop], agent: [Agent], socketPath: undefined, method: 'POST', maxHeaderSize: undefined, insecureHTTPParser: undefined, joinDuplicateHeaders: undefined, path: '/json', _ended: false, res: null, aborted: false, timeoutCb: null, upgradeOrConnect: false, parser: [HTTPParser], maxHeadersCount: null, reusedSocket: false, host: 'gateway.trxservices.net', protocol: 'https:', _redirectable: [Circular *1], [Symbol(kCapture)]: false, [Symbol(kBytesWritten)]: 0, [Symbol(kNeedDrain)]: false, [Symbol(corked)]: 0, [Symbol(kOutHeaders)]: [Object: null prototype], [Symbol(errored)]: null, [Symbol(kHighWaterMark)]: 16384, [Symbol(kRejectNonStandardBodyWrites)]: false, [Symbol(kUniqueHeaders)]: null }, _currentUrl: 'https://gateway.trxservices.net/json', _timeout: null, [Symbol(kCapture)]: false } }
2024-09-17 13:26:38.780 HKT
OPTIONS204258 B3 msChrome 128 https://us-central1-yumciti-64e70.cloudfunctions.net/processStorageSafeInsert
2024-09-17 13:26:38.993 HKT
POST200324 B30 sChrome 128 https://us-central1-yumciti-64e70.cloudfunctions.net/processStorageSafeInsert
2024-09-17 13:26:39.002 HKT
Callable request verification passed
2024-09-17 13:26:39.002 HKT
request { Message: { Request: { Detail: [Object], Account: [Object] } } }
2024-09-17 13:27:09.007 HKT
Error processing Storage Safe request: AxiosError: timeout of 30000ms exceeded at RedirectableReque

Were you able to successfully deploy your functions?

Yes, but 5/6 times it will get a timeout, sometimes receiving timeouts all the time
Screenshot 2024-09-17 134013

@google-oss-bot
Copy link
Collaborator

I found a few problems with this issue:

  • I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight.
  • This issue does not have all the information required by the template. Looks like you forgot to fill out some sections. Please update the issue with more information.

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

No branches or pull requests

2 participants