Skip to content

fix(ic-agent): fix ic-agent for web worker environments #651

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

rupansh
Copy link

@rupansh rupansh commented Jul 3, 2025

Description

When ic-agent is used inside a rust web worker environment, the sleep function panics as the window object is not available. This PR fixes the sleep function so it uses the appropriate self object instead (more here: https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Using_web_workers#web_workers_api)

How Has This Been Tested?

Its a bit difficult to test this e2e as I encountered this panic when my worker was rate limited. I can create a minimal web worker which specifically uses sleep written like this if you feel its necessary.

Checklist:

  • The title of this PR complies with Conventional Commits.
  • I have edited the CHANGELOG accordingly.
  • I have made corresponding changes to the documentation.

@rupansh rupansh requested a review from a team as a code owner July 3, 2025 18:45
@rupansh rupansh changed the title Fix ic-agent for web worker environments fix(ic-agent): fix ic-agent for web worker environments Jul 3, 2025
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