workers-sdk
workers-sdk copied to clipboard
bug: remote dev session expires and doesn't refresh
trafficstars
Since we landed https://github.com/cloudflare/wrangler2/pull/1391, the session doesn't refresh on every script change. This means when the dev session created on the edge does expire, the dev session breaks, and you have to restart to get it to work again. The error looks like this: Error on remote worker: workers.api.error.expired_preview_token [code: 10049]
The fix here is to detect when this error is thrown and refresh the session.
(We risk throwing away some state here, but it's better than nothing. There's a separate conversation to have about somehow pinging this to keep it alive, but that's for later.)