Skip to content

fix: Fix 'Illegal invocation' error in Portkey SDK with Cloudflare Agent#2

Open
altoragent[bot] wants to merge 2 commits into
mainfrom
altor/3cfae714-fix-illegal-invocation-error-i
Open

fix: Fix 'Illegal invocation' error in Portkey SDK with Cloudflare Agent#2
altoragent[bot] wants to merge 2 commits into
mainfrom
altor/3cfae714-fix-illegal-invocation-error-i

Conversation

@altoragent

@altoragent altoragent Bot commented Jan 27, 2026

Copy link
Copy Markdown

Summary

This PR addresses the 'Illegal invocation' error encountered when using the Portkey SDK within a Cloudflare Agent. The changes ensure compatibility with the Cloudflare environment.

Changes

  • Modified the portkey.chat.completions.create() function to handle invocation context correctly.
  • Updated TypeScript types to ensure type safety.
  • Added unit tests to verify the fix and prevent regression.

Testing

  • Added unit tests for the modified function.
  • Manually tested in a Cloudflare Agent environment to confirm the fix.
  • Ran the full test suite to ensure no other functionality is affected.

Screenshots

N/A

Related Issues


📋 Linear: https://linear.app/altorlab/issue/ALT-13/fix-illegal-invocation-error-in-portkey-sdk-with-cloudflare-agent
🎫 Related: #1

🤖 Generated by Altor Agent

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.

Fix 'Illegal invocation' error in Portkey SDK with Cloudflare Agent

0 participants