Skip to content

Conversation

DanRibbens
Copy link
Contributor

What?

When a script attempts to load payload using getPayload(), it will end with: Error: connect ECONNREFUSED 127.0.0.1:3000 etc...

Why?

Even though there is a try/catch, it still errors because WebSocket connection failures happen asynchronously after the ws object is instantiated.

How?

Added the error handling function cached.ws.onerror to prevent exit.

@DanRibbens DanRibbens added this to the v3.0 milestone Nov 17, 2024
@DanRibbens DanRibbens merged commit 488c28c into main Nov 18, 2024
58 checks passed
@DanRibbens DanRibbens deleted the fix/getpayload-ws-error branch November 18, 2024 14:03
Copy link
Contributor

🚀 This is included in version v3.0.0-beta.135

kendelljoseph pushed a commit that referenced this pull request Feb 21, 2025
### What?
When a script attempts to load payload using `getPayload()`, it will end
with: `Error: connect ECONNREFUSED 127.0.0.1:3000` etc...

### Why?

Even though there is a try/catch, it still errors because WebSocket
connection failures happen asynchronously after the ws object is
instantiated.

### How?

Added the error handling function cached.ws.onerror to prevent exit.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant