Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

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

About the future of wrangler-proxy since [email protected] and up exposes getBindingsProxy #23

Closed
Jolg42 opened this issue Jan 30, 2024 · 4 comments

Comments

@Jolg42
Copy link

Jolg42 commented Jan 30, 2024

Hello!

Since https://github.com/cloudflare/workers-sdk/releases/tag/wrangler%403.24.0 it is now possible to do the following:

import { getBindingsProxy } from "wrangler";

const { bindings, dispose } = await getBindingsProxy();

try {
	const myKv = bindings.MY_KV;
	const kvValue = await myKv.get("my-kv-key");

	console.log(`KV Value = ${kvValue}`);
} finally {
	await dispose();
}

The PR is cloudflare/workers-sdk#4523

@chientrm Maybe you already know about this, I wanted to mention it, in my context I first used wrangler-proxy, to query D1, which worked great! And now switched to getBindingsProxy and it also works great! I like how it's an official feature now 🙌🏼

So, I'm not sure what it means for this project here, if you see the need to continue or to recommend getBindingsProxy instead? Just curious about your thoughts.

@chientrm
Copy link
Owner

chientrm commented Jan 30, 2024

Hello!

Since https://github.com/cloudflare/workers-sdk/releases/tag/wrangler%403.24.0 it is now possible to do the following:

import { getBindingsProxy } from "wrangler";

const { bindings, dispose } = await getBindingsProxy();

try {
	const myKv = bindings.MY_KV;
	const kvValue = await myKv.get("my-kv-key");

	console.log(`KV Value = ${kvValue}`);
} finally {
	await dispose();
}

The PR is cloudflare/workers-sdk#4523

@chientrm Maybe you already know about this, I wanted to mention it, in my context I first used wrangler-proxy, to query D1, which worked great! And now switched to getBindingsProxy and it also works great! I like how it's an official feature now 🙌🏼

So, I'm not sure what it means for this project here, if you see the need to continue or to recommend getBindingsProxy instead? Just curious about your thoughts.

Ohm, maybe I'll add some auth layers and make wrangler-proxy a way for people to expose and access Workers resources over the internet 🤔 .
I'll still use wrangler-proxy for a while until getBindingsProxy is stable proof 👍

@nicolas-albert
Copy link

I recently attempted this approach.
While it successfully connects my local D1 instance with a miniflare, I haven't been able to determine if it can establish a connection with my remote/production D1.
This functionality is crucial for me to query D1 during my application's build process.
For the time being, I'm utilizing the following command: wrangler dev node_modules/wrangler-proxy/dist/worker.js --remote.

@chientrm
Copy link
Owner

chientrm commented Feb 1, 2024

I recently attempted this approach.
While it successfully connects my local D1 instance with a miniflare, I haven't been able to determine if it can establish a connection with my remote/production D1.
This functionality is crucial for me to query D1 during my application's build process.
For the time being, I'm utilizing the following command: wrangler dev node_modules/wrangler-proxy/dist/worker.js --remote.

Yep I started building wrangler-proxy when --local mode was just experimenting.

@Jolg42
Copy link
Author

Jolg42 commented Feb 1, 2024

Oh I see! I'm only using it locally for tests on my side. This is interesting.

Repository owner locked and limited conversation to collaborators Feb 3, 2024
@chientrm chientrm converted this issue into discussion #25 Feb 3, 2024

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants