Skip to content

Commit 78a9a2d

Browse files
authored
Revert "Hyperdrive dev remote fix" (#7868)
* Revert "Hyperdrive dev remote fix (#7783)" This reverts commit a2f695b. * Create silver-pillows-listen.md
1 parent bdc7958 commit 78a9a2d

File tree

8 files changed

+8
-104
lines changed

8 files changed

+8
-104
lines changed

.changeset/nervous-jeans-obey.md

Lines changed: 0 additions & 5 deletions
This file was deleted.
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"wrangler": patch
3+
---
4+
5+
Revert "Hyperdrive dev remote fix". This PR includes e2e tests that were not run before merging, and are currently failing.

.github/workflows/e2e.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@ jobs:
4848
env:
4949
CLOUDFLARE_API_TOKEN: ${{ secrets.TEST_CLOUDFLARE_API_TOKEN }}
5050
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.TEST_CLOUDFLARE_ACCOUNT_ID }}
51-
HYPERDRIVE_DATABASE_URL: ${{ secrets.TEST_HYPERDRIVE_DATABASE_URL}}
5251
WRANGLER: node --no-warnings ${{ github.workspace}}/packages/wrangler/bin/wrangler.js
5352
WRANGLER_IMPORT: ${{ github.workspace}}/packages/wrangler/wrangler-dist/cli.js
5453
NODE_OPTIONS: "--max_old_space_size=8192"

packages/wrangler/e2e/dev-with-resources.test.ts

Lines changed: 1 addition & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -580,35 +580,6 @@ describe.sequential.each(RUNTIMES)("Bindings: $flags", ({ runtime, flags }) => {
580580
);
581581
});
582582

583-
it("exposes Hyperdrive bindings", async () => {
584-
const { id } = await helper.hyperdrive(false);
585-
586-
await helper.seed({
587-
"wrangler.toml": dedent`
588-
name = "${workerName}"
589-
main = "src/index.ts"
590-
compatibility_date = "2023-10-25"
591-
592-
[[hyperdrive]]
593-
binding = "HYPERDRIVE"
594-
id = "${id}"
595-
`,
596-
"src/index.ts": dedent`
597-
export default {
598-
async fetch(request, env) {
599-
if (request.url.includes("connect")) {
600-
const conn = env.HYPERDRIVE.connect();
601-
}
602-
return new Response(env.HYPERDRIVE?.connectionString ?? "no")
603-
}
604-
}`,
605-
});
606-
607-
const worker = helper.runLongLived(`wrangler dev ${flags}`);
608-
const { url } = await worker.waitForReady();
609-
await fetch(`${url}/connect`);
610-
});
611-
612583
it.skipIf(!isLocal).fails("exposes Pipelines bindings", async () => {
613584
await helper.seed({
614585
"wrangler.toml": dedent`
@@ -721,6 +692,7 @@ describe.sequential.each(RUNTIMES)("Bindings: $flags", ({ runtime, flags }) => {
721692
});
722693

723694
// TODO(soon): implement E2E tests for other bindings
695+
it.todo("exposes hyperdrive bindings");
724696
it.skipIf(isLocal).todo("exposes send email bindings");
725697
it.skipIf(isLocal).todo("exposes browser bindings");
726698
it.skipIf(isLocal).todo("exposes Workers AI bindings");

packages/wrangler/e2e/dev.test.ts

Lines changed: 0 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -653,44 +653,6 @@ describe("hyperdrive dev tests", () => {
653653
await socketMsgPromise;
654654
});
655655

656-
it("does not require local connection string when running `wrangler dev --remote`", async () => {
657-
const helper = new WranglerE2ETestHelper();
658-
const { id } = await helper.hyperdrive(false);
659-
660-
await helper.seed({
661-
"wrangler.toml": dedent`
662-
name = "${workerName}"
663-
main = "src/index.ts"
664-
compatibility_date = "2023-10-25"
665-
666-
[[hyperdrive]]
667-
binding = "HYPERDRIVE"
668-
id = "${id}"
669-
`,
670-
"src/index.ts": dedent`
671-
export default {
672-
async fetch(request, env) {
673-
if (request.url.includes("connect")) {
674-
const conn = env.HYPERDRIVE.connect();
675-
}
676-
return new Response(env.HYPERDRIVE?.connectionString ?? "no")
677-
}
678-
}`,
679-
"package.json": dedent`
680-
{
681-
"name": "worker",
682-
"version": "0.0.0",
683-
"private": true
684-
}
685-
`,
686-
});
687-
688-
const worker = helper.runLongLived("wrangler dev --remote");
689-
690-
const { url } = await worker.waitForReady();
691-
await fetch(`${url}/connect`);
692-
});
693-
694656
afterEach(() => {
695657
if (server.listening) {
696658
server.close();

packages/wrangler/e2e/helpers/e2e-wrangler-test.ts

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -124,27 +124,4 @@ export class WranglerE2ETestHelper {
124124

125125
return name;
126126
}
127-
128-
async hyperdrive(isLocal: boolean): Promise<{ id: string; name: string }> {
129-
const name = generateResourceName("hyperdrive");
130-
131-
if (isLocal) {
132-
return { id: crypto.randomUUID(), name };
133-
}
134-
135-
const result = await this.run(
136-
`wrangler hyperdrive create ${name} --connection-string="${process.env.HYPERDRIVE_DATABASE_URL}"`
137-
);
138-
const tomlMatch = /id = "([0-9a-f]{32})"/.exec(result.stdout);
139-
const jsonMatch = /"id": "([0-9a-f]{32})"/.exec(result.stdout);
140-
const match = jsonMatch ?? tomlMatch;
141-
assert(match !== null, `Cannot find ID in ${JSON.stringify(result)}`);
142-
const id = match[1];
143-
144-
onTestFinished(async () => {
145-
await this.run(`wrangler hyperdrive delete ${name}`);
146-
});
147-
148-
return { id, name };
149-
}
150127
}

packages/wrangler/src/dev.ts

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1020,12 +1020,7 @@ export function getBindings(
10201020
process.env[
10211021
`WRANGLER_HYPERDRIVE_LOCAL_CONNECTION_STRING_${hyperdrive.binding}`
10221022
];
1023-
// only require a local connection string in the wrangler file or the env if not using dev --remote
1024-
if (
1025-
local &&
1026-
!connectionStringFromEnv &&
1027-
!hyperdrive.localConnectionString
1028-
) {
1023+
if (!connectionStringFromEnv && !hyperdrive.localConnectionString) {
10291024
throw new UserError(
10301025
`When developing locally, you should use a local Postgres connection string to emulate Hyperdrive functionality. Please setup Postgres locally and set the value of the 'WRANGLER_HYPERDRIVE_LOCAL_CONNECTION_STRING_${hyperdrive.binding}' variable or "${hyperdrive.binding}"'s "localConnectionString" to the Postgres connection string.`
10311026
);

packages/wrangler/turbo.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,7 @@
5959
"WRANGLER_DISABLE_EXPERIMENTAL_WARNING",
6060
"WRANGLER_DISABLE_REQUEST_BODY_DRAINING",
6161
"WRANGLER_WORKER_REGISTRY_PORT",
62-
"WRANGLER_API_ENVIRONMENT",
63-
"HYPERDRIVE_DATABASE_URL"
62+
"WRANGLER_API_ENVIRONMENT"
6463
]
6564
},
6665
"test:ci": {

0 commit comments

Comments
 (0)