Skip to content

Conversation

kchro3
Copy link

@kchro3 kchro3 commented Aug 8, 2025

Attempt at resolving this issue: #321

Copy link

changeset-bot bot commented Aug 8, 2025

⚠️ No Changeset found

Latest commit: b00f773

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Copy link

pkg-pr-new bot commented Aug 11, 2025

Open in StackBlitz

npm i https://pkg.pr.new/cloudflare/agents@401

commit: b00f773

@whoiskatrin
Copy link
Collaborator

@kchro3 do you mind taking a look at the build and fixing it?

@whoiskatrin whoiskatrin requested review from threepointone and ghostwriternr and removed request for threepointone August 13, 2025 16:40
@kchro3
Copy link
Author

kchro3 commented Aug 13, 2025

I don't think I was actually running into this issue in the end.

I was trying to fix an issue where I needed to reconnect & reauthenticate my MCP connections after the DO woke up from hibernating, but I had assumed that onConnect would happen again before onMessage. It turns out that the websocket connection is still live, so queuing the messages wouldn't have fixed that issue for me. Instead, I had to store the auth credentials using serializeAttachment on the first onConnect, and in future onMessages, if the MCPs were disconnected, it would deserializeAttachment and try again.

Since making that fix, I haven't run into the issue where onMessage happened before onConnect. Still happy to tinker with it on the weekend if folks think this is a good idea, though.

@whoiskatrin
Copy link
Collaborator

@kchro3 up to you, i will check the original issue this weekend i think

@whoiskatrin
Copy link
Collaborator

closing this as the bug has been fixed and fix has been merged into the last version now

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

Successfully merging this pull request may close these issues.

2 participants