Skip to content

Conversation

aron
Copy link
Contributor

@aron aron commented Mar 7, 2024

This is currently failing but acts as a starting point for verifying that we can run the Replicate library on Cloudflare workers.

The test uses a simple Cloudflare Worker implementation that uses the streaming API (as this exercises a bunch of the API surface area) to stream back a response from a language model and uses the experimental unstable_dev functionality in the wrangler library to run the worker via workerd in a test. We then verify that the test receives a successful response.

Currently we have the following issues:

  • node:crypto needs to be replaced with web crypto (node >= 15).
  • replace Buffer with Blob where possible or abstract behind a conditional.
  • process.env also needs to be accessed behind a conditional.

This is currently failing but acts as a starting point for verifying that
we can run the Replicate library on Cloudflare workers.

The test creates a cloudflare worker that uses the streaming API (as this
exercises a bunch of the API surface area) and uses the experimental
unstable_dev library to run the worker in a test. We then verify that
the test receives a successful response.

Currently we have the following issues:

* `node:crypto` needs to be replaced with web crypto (node >= 15).
* replace Buffer with Blob where possible or abstract behind a conditional.
* `process.env` also needs to be accessed behind a conditional.
Copy link
Contributor

@mattt mattt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is awesome, @aron! Really glad to have test coverage for Cloudflare Workers.

Co-authored-by: Mattt <mattt@replicate.com>
@aron aron merged commit 91a35e5 into main Mar 7, 2024
@aron aron deleted the cloudflare-integration branch March 7, 2024 13:31
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