deploy_feedback icon indicating copy to clipboard operation
deploy_feedback copied to clipboard

[Bug]: logs showing the deployment still in preview after promote to production. Crons not showed in production, maybe for the same reason

Open Mat-moran opened this issue 8 months ago • 0 comments

Problem description

I have promoted my deployment to production and I see a message in the logs as the deployment still in preview.

I do not see the crons I have in my code and I think is related with this issue.

Image

Steps to reproduce

  1. create a simple deno project with a cron inside
  2. deploy to deno deploy with deployctl deploy

Expected behavior

When a deployment is promoted to production their crons should appear in its corresponding tab and the logs should't show the message

Crons are not supported for preview deployments. Cron jobs will not be executed in this context.

Environment

No response

Possible solution

No response

Additional context

// NOTE: Crons should be defined at top level module scope
Deno.cron("sample cron", "* * * * *", () => {
  console.log(`Hello at ${new Date(Date.now()).toString()}`);
});
import * as supabase_js from "jsr:@supabase/supabase-js";
const BOOK_ROUTE = new URLPattern({ pathname: "/books/:id" });
import { createClient } from "jsr:@supabase/supabase-js@2";

function handler(req: Request): Response {
  Deno.cron("sample cron", "*/10 * * * *", () => {
    console.log("cron job executed every 10 minutes");
  });
  const match = BOOK_ROUTE.exec(req.url);
  if (match) {
    const id = match.pathname.groups.id;
    return new Response(`Book ${id}`);
  }
  return new Response("Not found (try /books/1)", {
    status: 404,
  });
}
Deno.serve(handler);

console.log("HOLA fuera del CRON");

Mat-moran avatar May 29 '25 13:05 Mat-moran