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

UND_ERR_CONNECT_TIMEOUT when calling /refresh #28

Open
geoffrich opened this issue Jan 16, 2023 · 3 comments
Open

UND_ERR_CONNECT_TIMEOUT when calling /refresh #28

geoffrich opened this issue Jan 16, 2023 · 3 comments
Labels
bug Something isn't working

Comments

@geoffrich
Copy link
Owner

The request to refresh the cache (implemented in #10) seems to regularly fail. Not sure if bumping undici or trying node 18 would fix it. There may be some weirdness going on since we're requesting back into the site.

Could also see if waiting some time (e.g. 100ms) for the request to be dispatched would help.

At time of writing, it still succeeds enough - recent comics are shown on the site.

Jan 16, 11:00:58 AM: 574be9e6 INFO   Getting comics for 1949
Jan 16, 11:00:58 AM: 574be9e6 ERROR  Refresh error TypeError: fetch failed
    at fetch (file:///var/task/.netlify/shims.js:20554:14)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at runNextTicks (node:internal/process/task_queues:65:3)
    at processImmediate (node:internal/timers:437:9) {
  cause: ConnectTimeoutError: Connect Timeout Error
      at onConnectTimeout (file:///var/task/.netlify/shims.js:6979:26)
      at file:///var/task/.netlify/shims.js:6926:46
      at Immediate._onImmediate (file:///var/task/.netlify/shims.js:6967:9)
      at processImmediate (node:internal/timers:466:21) {
    code: 'UND_ERR_CONNECT_TIMEOUT'
  }
}
Jan 16, 11:00:58 AM: 574be9e6 ERROR  Refresh error TypeError: fetch failed
    at fetch (file:///var/task/.netlify/shims.js:20554:14)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at runNextTicks (node:internal/process/task_queues:65:3)
    at processImmediate (node:internal/timers:437:9) {
  cause: ConnectTimeoutError: Connect Timeout Error
      at onConnectTimeout (file:///var/task/.netlify/shims.js:6979:26)
      at file:///var/task/.netlify/shims.js:6926:46
      at Immediate._onImmediate (file:///var/task/.netlify/shims.js:6967:9)
      at processImmediate (node:internal/timers:466:21) {
    code: 'UND_ERR_CONNECT_TIMEOUT'
  }
}
Jan 16, 11:00:58 AM: 574be9e6 ERROR  Refresh error TypeError: fetch failed
    at fetch (file:///var/task/.netlify/shims.js:20554:14)
    at processTicksAndRejections (node:internal/process/task_queues:96:5) {
  cause: ConnectTimeoutError: Connect Timeout Error
      at onConnectTimeout (file:///var/task/.netlify/shims.js:6979:26)
      at file:///var/task/.netlify/shims.js:6926:46
      at Immediate._onImmediate (file:///var/task/.netlify/shims.js:6967:9)
      at processImmediate (node:internal/timers:466:21) {
    code: 'UND_ERR_CONNECT_TIMEOUT'
  }
}
Jan 16, 11:00:58 AM: 574be9e6 INFO   Total comics: 8
Jan 16, 11:00:58 AM: 574be9e6 INFO   cache checked in 0.2994936400000006
Jan 16, 11:00:58 AM: 574be9e6 INFO   retrieving 1949 page 0
Jan 16, 11:00:58 AM: 574be9e6 INFO   data for 1949 page 0 is stale, firing refresh request to https://marvel.geoffrich.net/year/1949/refresh
Jan 16, 11:00:58 AM: 574be9e6 INFO   found 1949 page 0 in redis cache
Jan 16, 11:00:58 AM: 574be9e6 INFO   elapsed 0.3023234890000895
Jan 16, 11:00:58 AM: 574be9e6 Duration: 335.94 ms	Memory Usage: 158 MB	

The code is here:

fetch(refreshUrl, {
body: JSON.stringify(request),
headers: {
'Content-Type': 'application/json'
},
method: 'POST'
}).catch((e) => {
console.error('Refresh error', e);
});

@geoffrich geoffrich added the bug Something isn't working label Jan 16, 2023
@geoffrich
Copy link
Owner Author

Another (potentially related) error:

Jan 16, 11:09:19 AM: 641700be ERROR  Refresh error TypeError: fetch failed
    at fetch (file:///var/task/.netlify/shims.js:20554:14) {
  cause: SocketError: other side closed
      at TLSSocket.onSocketEnd (file:///var/task/.netlify/shims.js:8489:24)
      at TLSSocket.emit (node:events:539:35)
      at endReadableNT (node:internal/streams/readable:1345:12)
      at processTicksAndRejections (node:internal/process/task_queues:83:21) {
    code: 'UND_ERR_SOCKET',
    socket: {
      localAddress: '169.254.76.1',
      localPort: 34842,
      remoteAddress: '34.148.19.16',
      remotePort: 443,
      remoteFamily: 'IPv4',
      timeout: undefined,
      bytesWritten: 3556,
      bytesRead: 0
    }
  }
}

@geoffrich
Copy link
Owner Author

From nodejs/undici issue 1531, it seems like it could be an ipv6 config issue? Maybe something wrong with the marvel.geoffrich.net domain?

@geoffrich
Copy link
Owner Author

Clicked the big "enable ipv6" on Netlify DNS, we'll see if that fixes it (probably need to wait for changes to propagate)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant