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

Support cloudflare wrangler #7290

Closed
bkniffler opened this issue Nov 23, 2023 · 5 comments
Closed

Support cloudflare wrangler #7290

bkniffler opened this issue Nov 23, 2023 · 5 comments
Labels
enhancement New feature or request

Comments

@bkniffler
Copy link

What is the problem this feature would solve?

Error when trying to use wrangler, e.g. to run a test for a cloudflare worker.

Message

[bun] Warning: worker_threads.Worker option "execArgv" is not implemented.

Code example

import {expect, test} from 'bun:test'
import {unstable_dev} from 'wrangler'
import {join} from 'path'

const root = join(__dirname, '../../..')
test('durable-objects', async () => {
  const handler  = await unstable_dev(join(root, 'src/index.ts'), {
    config: join(root, 'wrangler.toml'),
    experimental: {
      disableExperimentalWarning: true,
      disableDevRegistry: true
    },
    bundle: false,
    compatibilityDate: '2023-10-10',
    local: true,
    logLevel: 'debug',
  });
  const res =await handler.fetch('http://worker.dev', {});
  const json = await res.json();
  expect(json).toEqual({hello: 'world'});
});

What is the feature you are proposing to solve the problem?

Add support for execArgv and thus for wrangler.

What alternatives have you considered?

Use vitest/jest.

@bkniffler bkniffler added the enhancement New feature or request label Nov 23, 2023
@bkniffler
Copy link
Author

Here is the execArgv support issue: #4130

@Electroid
Copy link
Contributor

Duplicate of #4130

@Electroid Electroid marked this as a duplicate of #4130 Nov 24, 2023
@Electroid Electroid closed this as not planned Won't fix, can't repro, duplicate, stale Nov 24, 2023
@bkniffler
Copy link
Author

Still not working yet unfortunately, waiting for #8867 to work for unstable_dev, for anyone stumbling upon this

@bkniffler
Copy link
Author

As well as #4165

@jbergstroem
Copy link
Contributor

jbergstroem commented Dec 17, 2024

Just ran across this and it still doesn't fully work for me. Put up a reproduction here: https://github.com/jbergstroem/bun-wrangler-test - basically the code you shared above plus an entrypoint:

index.ts

export default {
	async fetch(request: Request): Promise<Response> {
		return new Response("Hello World!");
	},
} satisfies ExportedHandler<Env>;

index.test.ts

import { expect, test } from "bun:test";
import { join } from "node:path";
import { unstable_dev } from "wrangler";

const root = join("./");
test("durable-objects", async () => {
	const handler = await unstable_dev("./index.js", {
		config: "./wrangler.toml",
		experimental: {
			disableExperimentalWarning: true,
			disableDevRegistry: true,
		},
		bundle: false,
		local: true,
		logLevel: "debug",
	});
	const res = await handler.fetch("http://worker.dev", {});
	const json = await res.json();
	expect(json).toEqual({ hello: "world" });
});

..since it trips on typescript syntax when bundling is off, I also did a javascript endpoint that ultimately also fails (bundle: true/false does not matter).

output:

Error in ProxyController: Failed to start ProxyWorker or InspectorProxyWorker
 Error: Unexpected server response: 101
    at <anonymous> (/Users/jbergstroem/wrk/oss/bun-wrangler-test/node_modules/wrangler/wrangler-dist/cli.js:34415:11)
    at emit (node:events:73:22)
    at <anonymous> (node:http:1006:60)
    at processTicksAndRejections (native:7:39) {
  originalLine: 28738,
  originalColumn: 27
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants