Hi!
I got some problems while building my NextJS site. During the build process I sometimes get 502 responses for API calls made in getStaticProps.
Example response below:
1:11:04 PM: response: {
1:11:04 PM: status: 502,
1:11:04 PM: statusText: ‘Bad Gateway’,
1:11:04 PM: headers: {
1:11:04 PM: age: ‘10’,
1:11:04 PM: ‘cache-control’: ‘no-cache’,
1:11:04 PM: ‘content-length’: ‘115’,
1:11:04 PM: ‘content-type’: ‘text/plain; charset=utf-8’,
1:11:04 PM: date: ‘Mon, 20 Feb 2023 12:10:54 GMT, Mon, 20 Feb 2023 12:11:04 GMT’,
1:11:04 PM: server: ‘Netlify’,
1:11:04 PM: ‘strict-transport-security’: ‘max-age=31536000’,
1:11:04 PM: vary: ‘Accept-Encoding’,
1:11:04 PM: ‘x-nf-request-id’: ‘01GSQBQTNG8KRAAZ3GSRRBSPAV’,
1:11:04 PM: connection: ‘close’
1:11:04 PM: },
1:11:04 PM: config: {
1:11:04 PM: transitional: [Object],
1:11:04 PM: adapter: [Function: httpAdapter],
1:11:04 PM: transformRequest: [Array],
1:11:04 PM: transformResponse: [Array],
1:11:04 PM: timeout: 0,
1:11:04 PM: xsrfCookieName: ‘XSRF-TOKEN’,
1:11:04 PM: xsrfHeaderName: ‘X-XSRF-TOKEN’,
1:11:04 PM: maxContentLength: -1,
1:11:04 PM: maxBodyLength: -1,
1:11:04 PM: validateStatus: [Function: validateStatus],
1:11:04 PM: headers: [Object],
1:11:04 PM: method: ‘get’,
1:11:04 PM: url: ‘https://stage.finansvalp.se/api/pages/findUri/investeringar’,
1:11:04 PM: data: undefined
1:11:04 PM: },
1:11:04 PM: request: <ref *1> ClientRequest {
1:11:04 PM: _events: [Object: null prototype],
1:11:04 PM: _eventsCount: 7,
1:11:04 PM: _maxListeners: undefined,
1:11:04 PM: outputData: ,
1:11:04 PM: outputSize: 0,
1:11:04 PM: writable: true,
1:11:04 PM: destroyed: false,
1:11:04 PM: _last: true,
1:11:04 PM: chunkedEncoding: false,
1:11:04 PM: shouldKeepAlive: false,
1:11:04 PM: maxRequestsOnConnectionReached: false,
1:11:04 PM: _defaultKeepAlive: true,
1:11:04 PM: useChunkedEncodingByDefault: false,
1:11:04 PM: sendDate: false,
1:11:04 PM: _removedConnection: false,
1:11:04 PM: _removedContLen: false,
1:11:04 PM: _removedTE: false,
1:11:04 PM: strictContentLength: false,
1:11:04 PM: _contentLength: 0,
1:11:04 PM: _hasBody: true,
1:11:04 PM: _trailer: ‘’,
1:11:04 PM: finished: true,
1:11:04 PM: _headerSent: true,
1:11:04 PM: _closed: false,
1:11:04 PM: socket: [TLSSocket],
1:11:04 PM: _header: ‘GET /api/pages/findUri/investeringar HTTP/1.1\r\n’ +
1:11:04 PM: ‘Accept: application/json, text/plain, /\r\n’ +
1:11:04 PM: ‘User-Agent: axios/0.25.0\r\n’ +
1:11:04 PM: ‘Host: stage.finansvalp.se\r\n’ +
1:11:04 PM: ‘Connection: close\r\n’ +
1:11:04 PM: ‘\r\n’,
1:11:04 PM: _keepAliveTimeout: 0,
1:11:04 PM: _onPendingData: [Function: nop],
1:11:04 PM: agent: [Agent],
1:11:04 PM: socketPath: undefined,
1:11:04 PM: method: ‘GET’,
1:11:04 PM: maxHeaderSize: undefined,
1:11:04 PM: insecureHTTPParser: undefined,
1:11:04 PM: path: ‘/api/pages/findUri/investeringar’,
1:11:04 PM: _ended: true,
1:11:04 PM: res: [IncomingMessage],
1:11:04 PM: aborted: false,
1:11:04 PM: timeoutCb: null,
1:11:04 PM: upgradeOrConnect: false,
1:11:04 PM: parser: null,
1:11:04 PM: maxHeadersCount: null,
1:11:04 PM: reusedSocket: false,
1:11:04 PM: host: ‘stage.finansvalp.se’,
1:11:04 PM: protocol: ‘https:’,
1:11:04 PM: _redirectable: [Writable],
1:11:04 PM: [Symbol(kCapture)]: false,
1:11:04 PM: [Symbol(kBytesWritten)]: 0,
1:11:04 PM: [Symbol(kEndCalled)]: true,
1:11:04 PM: [Symbol(kNeedDrain)]: false,
1:11:04 PM: [Symbol(corked)]: 0,
1:11:04 PM: [Symbol(kOutHeaders)]: [Object: null prototype],
1:11:04 PM: [Symbol(kUniqueHeaders)]: null
1:11:04 PM: },
1:11:04 PM: data: {
1:11:04 PM: errorMessage: ‘2023-02-20T12:11:04.931Z 7e777685-d3b4-440d-87a5-d4cb28fec1f0 Task timed out after 10.01 seconds’
1:11:04 PM: }
1:11:04 PM: },
Example x-nf-request-id ids below:
01GSQBQTN5674FHH17F6MBWKVY
01GSQBQTM0J1G20CQBR26CSXSQ
01GSQBQTP270XH5EVAXRWC481D
01GSQBQTNG8KRAAZ3GSRRBSPAV
Site:
https://stage.finansvalp.se
Example API call:
https://stage.finansvalp.se/api/pages/findUri/investeringar
Trying to figure out if this is Netlify related before I move on to checking my WP backend that I am querying for data.
Thanks in advance.