Skip to content

Deno.cron() - Weird (async) behaviour #28957

Open
@mbodm

Description

@mbodm

Version: Deno 2 Latest

It seems you can not use an async () => expression with Deno.cron() in Deno Deploy. At least for me it seems not working. Or do i miss something here? Documentation says not much about it.

When i use it, as in an example from Deno, something strange happens:

The then() block (or the part after an "await" - when using a/a) is being called fine. But the asynchronous method itself somehow not correctly executes.

You can find my rather small project here: https://github.com/mbodm/wowcam-deno

  • It has a server (in server.ts) which serves an API (by using Deno.serve())
  • The endpoint "scrapes/update" calls the update() function in logic.ts
  • In main.ts you see the Deno.cron() job
  • The CRON job also calls the update() function in logic.ts

If i call above endpoint from the browser, the update() function is running fine. When called by the Deno.cron() handler, nothing happens.

I don`t get it... :(

PS: Also a fetch() call not works inside the Deno CRON handler.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions