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

Document how to load in a Cloudflare Workers script #47

Closed
sorenbs opened this issue Oct 15, 2023 · 5 comments
Closed

Document how to load in a Cloudflare Workers script #47

sorenbs opened this issue Oct 15, 2023 · 5 comments

Comments

@sorenbs
Copy link

sorenbs commented Oct 15, 2023

Running in-memory SQLite on Cloudflare Workers has a number of use cases.

Cloudflare Workers supports WASM, and previous work by the community suggests that it is possible to get a wasm version of SQLite to run in a workers script.

Documenting how to get the official SQLite WASM distribution to work on Cloudflare Workers would be a great help.

@tomayac
Copy link
Collaborator

tomayac commented Oct 16, 2023

The package is primarily thought for the browser. It may be possible to get it to run in non-browser environments, but not necessarily. For example, it is known to not currently work on Node.js. If you manage to get it to run on Cloudflare Workers, happy to add a link to documentation to do so in the README.

@tomayac tomayac closed this as not planned Won't fix, can't repro, duplicate, stale Oct 16, 2023
@sorenbs
Copy link
Author

sorenbs commented Oct 16, 2023

Thank you @tomayac!

I intend to open a bounty to figure out the details and write up instructions for how to get it to work. Would it be okay for such a writeup to be created in this thread, or do you prefer it in an external blogpost? I want to be mindful of not creating unwanted work for you and the team.

@tomayac
Copy link
Collaborator

tomayac commented Oct 16, 2023

Thank you! Ideally this documentation would live somewhere on someone's blog, or maybe on StackOverflow or so. Just to make clear that it's distinct from the project.

Should this library end up being usable on more platforms, like Node in the future, we would of course document it here.

@sgbeal
Copy link
Collaborator

sgbeal commented Oct 16, 2023

or maybe on StackOverflow or so.

Ha! Pun probably not intended ;).

@sorenbs in the upstream library we have a build which supposedly works with node.js, but none of the upstream devs (🙋) actually use node in any capacity, so we have to rely on the reports of users that it works. The wasm dist file:

https://www.sqlite.org/download.html

(search that page for "wasm") contains a file called sqlite3-node.mjs which you "should" be able to use as a basis. It is not available via npm (none of have any use for npm, either!). Feel free to contact me (stephan sqlite org) if you have feedback for that build (like "it doesn't work at all" or "it works if you change this one part...").

If you can get that working without having to go through npm then we will be happy to host a howto doc on sqlite.org/wasm.

Edit: PS: the prerelease snapshps at https://sqlite.org/wasm/uv/snapshot.html are newer, based on yesterday's trunk. That shouldn't affect you for most stuff, but may if you intended to use one of the OPFS-backed VFSes, as those have received small additions since the 3.43 release.

@tomayac
Copy link
Collaborator

tomayac commented Oct 17, 2023

Some Node.js experiments in #48.

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

3 participants