Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -246,8 +246,8 @@ if (auth) {
}>({
configPath: "./.tmp/config-with-invalid-account-id/wrangler.json",
})
).rejects.toThrowError(
/Failed to start the remote proxy session\. Failed to create a preview token/
).rejects.toMatchInlineSnapshot(
`[Error: Failed to start the remote proxy session. Error reloading remote server: A request to the Cloudflare API (/accounts/NOT a valid account id/workers/subdomain/edge-preview) failed.]`
);

expect(errorSpy).toHaveBeenCalledOnce();
Expand Down
29 changes: 19 additions & 10 deletions packages/wrangler/e2e/remote-binding/remote-bindings-api.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {
importWrangler,
WranglerE2ETestHelper,
} from "../helpers/e2e-wrangler-test";
import { normalizeOutput } from "../helpers/normalize";
import type {
MiniflareOptions,
Miniflare as MiniflareType,
Expand Down Expand Up @@ -82,8 +83,9 @@ describe.skipIf(!CLOUDFLARE_ACCOUNT_ID)(
});

test("user provided incorrect auth data", async ({ expect }) => {
await expect(
startRemoteProxySession(
let error: unknown;
try {
await startRemoteProxySession(
{
MY_SERVICE: {
type: "service",
Expand All @@ -98,9 +100,12 @@ describe.skipIf(!CLOUDFLARE_ACCOUNT_ID)(
},
},
}
)
).rejects.toThrowError(
/Failed to start the remote proxy session\. Failed to create a preview token/
);
} catch (e) {
error = e;
}
expect(normalizeOutput(`${error}`)).toMatchInlineSnapshot(
`"Error: Failed to start the remote proxy session. Error reloading remote server: A request to the Cloudflare API (/accounts/00000000000000000000000000000000/workers/subdomain/edge-preview) failed."`
);
Comment thread
petebacondarwin marked this conversation as resolved.
Comment thread
petebacondarwin marked this conversation as resolved.
});
});
Expand Down Expand Up @@ -137,8 +142,9 @@ describe.skipIf(!CLOUDFLARE_ACCOUNT_ID)(
});

test("user provided incorrect auth data", async ({ expect }) => {
await expect(
maybeStartOrUpdateRemoteProxySession(
let error: unknown;
try {
await maybeStartOrUpdateRemoteProxySession(
{
bindings: {
MY_SERVICE: {
Expand All @@ -155,9 +161,12 @@ describe.skipIf(!CLOUDFLARE_ACCOUNT_ID)(
apiToken: "This is an incorrect API TOKEN!",
},
}
)
).rejects.toThrowError(
/Failed to start the remote proxy session\. Failed to create a preview token/
);
} catch (e) {
error = e;
}
expect(normalizeOutput(`${error}`)).toMatchInlineSnapshot(
`"Error: Failed to start the remote proxy session. Error reloading remote server: A request to the Cloudflare API (/accounts/00000000000000000000000000000000/workers/subdomain/edge-preview) failed."`
);
Comment thread
petebacondarwin marked this conversation as resolved.
});
});
Expand Down
Loading