Skip to content

Commit 31134d7

Browse files
committed
fixup! WORKER_SELF_REFERENCE
1 parent ad91409 commit 31134d7

File tree

12 files changed

+21
-21
lines changed

12 files changed

+21
-21
lines changed

examples/e2e/app-pages-router/wrangler.jsonc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
],
1717
"services": [
1818
{
19-
"binding": "NEXT_CACHE_REVALIDATION_WORKER",
19+
"binding": "WORKER_SELF_REFERENCE",
2020
"service": "app-pages-router"
2121
}
2222
]

examples/e2e/app-router/wrangler.jsonc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
],
3535
"services": [
3636
{
37-
"binding": "NEXT_CACHE_REVALIDATION_WORKER",
37+
"binding": "WORKER_SELF_REFERENCE",
3838
"service": "app-router"
3939
}
4040
]

examples/e2e/pages-router/wrangler.jsonc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
],
1717
"services": [
1818
{
19-
"binding": "NEXT_CACHE_REVALIDATION_WORKER",
19+
"binding": "WORKER_SELF_REFERENCE",
2020
"service": "pages-router"
2121
}
2222
]

examples/overrides/memory-queue/wrangler.jsonc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
],
1717
"services": [
1818
{
19-
"binding": "NEXT_CACHE_REVALIDATION_WORKER",
19+
"binding": "WORKER_SELF_REFERENCE",
2020
"service": "memory-queue"
2121
}
2222
]

examples/overrides/r2-incremental-cache/wrangler.jsonc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
],
2020
"services": [
2121
{
22-
"binding": "NEXT_CACHE_REVALIDATION_WORKER",
22+
"binding": "WORKER_SELF_REFERENCE",
2323
"service": "r2-incremental-cache-e2e"
2424
}
2525
],

packages/cloudflare/src/api/cloudflare-context.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ declare global {
1313
NEXTJS_ENV?: string;
1414

1515
// Service binding for the worker itself to be able to call itself from within the worker
16-
NEXT_CACHE_REVALIDATION_WORKER?: Service;
16+
WORKER_SELF_REFERENCE?: Service;
1717

1818
// KV used for the incremental cache
1919
NEXT_CACHE_KV?: KVNamespace;

packages/cloudflare/src/api/durable-objects/queue.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ const createDurableObjectQueue = ({
3737
};
3838
// eslint-disable-next-line @typescript-eslint/no-explicit-any
3939
return new DurableObjectQueueHandler(mockState as any, {
40-
NEXT_CACHE_REVALIDATION_WORKER: {
40+
WORKER_SELF_REFERENCE: {
4141
fetch: vi.fn().mockReturnValue(
4242
new Promise<Response>((res) =>
4343
setTimeout(

packages/cloudflare/src/api/durable-objects/queue.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ export class DurableObjectQueueHandler extends DurableObject<CloudflareEnv> {
2929

3030
routeInFailedState = new Map<string, FailedState>();
3131

32-
service: NonNullable<CloudflareEnv["NEXT_CACHE_REVALIDATION_WORKER"]>;
32+
service: NonNullable<CloudflareEnv["WORKER_SELF_REFERENCE"]>;
3333

3434
// Configurable params
3535
readonly maxRevalidations: number;
@@ -40,7 +40,7 @@ export class DurableObjectQueueHandler extends DurableObject<CloudflareEnv> {
4040

4141
constructor(ctx: DurableObjectState, env: CloudflareEnv) {
4242
super(ctx, env);
43-
this.service = env.NEXT_CACHE_REVALIDATION_WORKER!;
43+
this.service = env.WORKER_SELF_REFERENCE!;
4444
// If there is no service binding, we throw an error because we can't revalidate without it
4545
if (!this.service) throw new IgnorableError("No service binding for cache revalidation worker");
4646
this.sql = ctx.storage.sql;

packages/cloudflare/src/api/overrides/queue/memory-queue.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ vi.mock("./.next/prerender-manifest.json", () => Promise.resolve({ preview: { pr
88
const mockServiceWorkerFetch = vi.fn();
99
vi.mock("../../cloudflare-context", () => ({
1010
getCloudflareContext: () => ({
11-
env: { NEXT_CACHE_REVALIDATION_WORKER: { fetch: mockServiceWorkerFetch } },
11+
env: { WORKER_SELF_REFERENCE: { fetch: mockServiceWorkerFetch } },
1212
}),
1313
}));
1414

packages/cloudflare/src/api/overrides/queue/memory-queue.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ export const DEFAULT_REVALIDATION_TIMEOUT_MS = 10_000;
1111
*
1212
* It offers basic support for in-memory de-duping per isolate.
1313
*
14-
* A service binding called `NEXT_CACHE_REVALIDATION_WORKER` that points to your worker is required.
14+
* A service binding called `WORKER_SELF_REFERENCE` that points to your worker is required.
1515
*/
1616
export class MemoryQueue implements Queue {
1717
readonly name = "memory-queue";
@@ -21,7 +21,7 @@ export class MemoryQueue implements Queue {
2121
constructor(private opts = { revalidationTimeoutMs: DEFAULT_REVALIDATION_TIMEOUT_MS }) {}
2222

2323
async send({ MessageBody: { host, url }, MessageDeduplicationId }: QueueMessage): Promise<void> {
24-
const service = getCloudflareContext().env.NEXT_CACHE_REVALIDATION_WORKER;
24+
const service = getCloudflareContext().env.WORKER_SELF_REFERENCE;
2525
if (!service) throw new IgnorableError("No service binding for cache revalidation worker");
2626

2727
if (this.revalidatedPaths.has(MessageDeduplicationId)) return;

0 commit comments

Comments
 (0)