Skip to content
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

Cloudflare worker Uncaught ReferenceError: FinalizationRegistry is not defined #46

Open
EiffelFly opened this issue May 24, 2023 · 8 comments

Comments

@EiffelFly
Copy link

Hi, thanks for building this tool! I had encountered a problem when I tried to run this repo in cloudflare worker.

you could go to this repo to reproduce repo

  • pnpm i at the root folder
  • go into /packages/api folder and pnpm dev
  • select turn on local mode in the terminal

Then you will see the issue happening.

It is quite hard to find the solution on the web, so I am curious about how do you test the package on Cloudflare worker and make it work.

@KittenYang
Copy link

same here

@KittenYang
Copy link

back to this repo: https://github.com/niieani/gpt-tokenizer

@dqbd
Copy link
Owner

dqbd commented May 25, 2023

Hi! This does seem to be a regression caused by 1.0.7, will address this issue in later versions.

In the meantime, js-tiktoken is a pure JS version of the package, which should be more suitable for edge runtimes such as Cloudflare Workers.

@EiffelFly
Copy link
Author

@dqbd I can confirm js-toktoken is working correctly in edge-runtime due to langchainjs use this package under the hood!! Thanks for the head up.

@iwasrobbed
Copy link

Thanks @dqbd ! I was a bit confused as well since the readme still points towards using the wasm version

Is the plan to maintain both wasm and JS going forward?

@dqbd
Copy link
Owner

dqbd commented Aug 7, 2023

Yep! Both of the libraries have their advantages and disadvantages and the plan is to support both for the foreseeable future.

@dqbd dqbd closed this as completed Aug 7, 2023
@gablabelle
Copy link

gablabelle commented Sep 24, 2023

@dqbd I'm having the same issue on Vercel (edge function). Since you've closed the issue, what was the resolution of the problem? Migrate to js-tiktoken I guess? ;-)

@poweroutlet2
Copy link

Still running into this error using Vercel edge functions. Any updates here? Using js-tiktoken seems to make the edge function size >1MB

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

No branches or pull requests

6 participants