```js import { Container, getRandom } from "@cloudflare/containers"; interface Env { API: any; //

js import { Container, getRandom } from "@cloudflare/containers";

interface Env {
  API: any; // Container binding
  API_KEY: string;
  CLEANUP_TEMP_FILES: string;
  LOG_LEVEL: string;
  PORT: string;
  R2_ACCESS_KEY_ID: string;
  R2_BUCKET_NAME: string;
  R2_ENDPOINT_URL: string;
  R2_PUBLIC_URL: string;
  R2_SECRET_ACCESS_KEY: string;
}

export class PowerpointApi extends Container {
  declare env: Env;
  defaultPort = 8000;
  sleepAfter = "2m";
  envVars: Record<string, string> = {
    API_KEY: this.env.API_KEY,
    CLEANUP_TEMP_FILES: this.env.CLEANUP_TEMP_FILES,
    LOG_LEVEL: this.env.LOG_LEVEL,
    PORT: this.env.PORT,
    R2_ACCESS_KEY_ID: this.env.R2_ACCESS_KEY_ID,
    R2_BUCKET_NAME: this.env.R2_BUCKET_NAME,
    R2_ENDPOINT_URL: this.env.R2_ENDPOINT_URL,
    R2_PUBLIC_URL: this.env.R2_PUBLIC_URL,
    R2_SECRET_ACCESS_KEY: this.env.R2_SECRET_ACCESS_KEY,
  };

  override onStart() {
    console.log("Container successfully started");
  }

  override onStop() {
    console.log("Container successfully shut down");
  }

  override onError(error: unknown) {
    console.log("Container error:", error);
  }
}


export default {
  async fetch(request: Request, env: Env): Promise<Response> {
    const container = await getRandom(env.API, 25);
    return await container.fetch(request);
  },
} satisfies ExportedHandler<Env>;


There is no container instance that can be provided to this Durable Object, try again later - we are also getting this error a lot I am adding the config below.
image = "./Dockerfile"
max_instances = 25
instance_type = "standard-4"

Could you hint us that where are we going wrong for these two places?
image.png
Was this page helpful?