

wrangler containers images listX
•11/15/25, 12:27 AM



X
•11/17/25, 3:30 PM
SIGTERM in our container before it gets the SIGKILL. We added logging on a SIGTERM that never seems to trigger. We tried to manually do it via this.stop(), and it's not getting it via the default activityExpired handler either...SIGTERM by SIGKILL it all works. Code is below:onContainerRequest in container enabled durable objects, I keep getting the error: This member cannot have an 'override' modifier because it is not declared in the base class 'DurableObject<Env, {}>'.
runCode in SandboxSDK - @whoiskatrin tagging you so we can talk it thru getState on the container it wakes up the container? I need a place to see if the container is active or not without waking it up when. I am checking it state.wrangler containers images listSIGTERMSIGTERMSIGTERMSIGKILLSIGKILLimport { Container, getContainer } from "@cloudflare/containers";
export class Timer extends Container<Env> {
defaultPort = 3000;
sleepAfter = "30s";
async onActivityExpired() {
if (!this.ctx.container?.running) return;
this.stop("SIGTERM");
}
}
export default {
async fetch(request: Request, env: Env, ctx: ExecutionContext) {
const timerId =
new URL(request.url).searchParams.get("id") ?? crypto.randomUUID();
const timerStub = getContainer(env.TIMER, timerId);
await timerStub.startAndWaitForPorts({
startOptions: {
enableInternet: true,
},
ports: [3000],
});
return timerStub.fetch(request);
},
} satisfies ExportedHandler<Env>;onContainerRequestThis member cannot have an 'override' modifier because it is not declared in the base class 'DurableObject<Env, {}>'.runCodegetStateconst containerInstance = await getRandom(
env.API_CONTAINER,
INSTANCE_COUNT
);import { DurableObject } from 'cloudflare:workers';
export class ApiContainer extends DurableObject<Env> {
container: globalThis.Container;
monitor?: Promise<unknown>;
constructor(ctx: DurableObjectState, env: Env) {
super(ctx, env);
this.container = ctx.container!;
void this.ctx.blockConcurrencyWhile(async () => {
if (!this.container.running) this.container.start({
enableInternet: false,
workersAddress: '10.0.0.2:8080',
env: {
GOOGLE_CLIENT_ID: env.GOOGLE_CLIENT_ID
}
});
});
}
async fetch(req: Request) {
try {
return await this.container.getTcpPort(8080).fetch(req.url.replace('https:', 'http:'), req);
} catch (err: any) {
return new Response(`${this.ctx.id.toString()}: ${err.message}`, { status: 500 });
}
}
}
export default {
async fetch(request, env): Promise<Response> {
try {
return await env.API_CONTAINER.get(env.API_CONTAINER.idFromName(request.url)).fetch(request);
} catch (err: any) {
console.error('Error fetch:', err.message);
return new Response(err.message, { status: 500 });
}
},
} satisfies ExportedHandler<Env>;override async onContainerRequest(request: Request) {
// call KV, R2, etc if path starts with /cfservices
}// ... when starting the container...
this.ctx.container.start({
workersAddress: '10.0.0.2:8080',
enableInternet: false, // 'enableInternet' is false by default
});
// ... container requests to '10.0.0.2:8080' securely route to a different service...
override async onContainerRequest(request: Request) {
const containerId = this.env.SUB_SERVICE.idFromName(request.headers['X-Account-Id']);
return this.env.SUB_SERVICE.get(containerId).fetch(request);
}