Closed Akiyamka closed 4 months ago
@Akiyamka sorry you've had this issue. This appears to be a duplicate of #4263. In the meantime, you can either run wrangler deploy
directly from the created folder or deploy it via the dashboard.
I wasn't able to replicate the fetch
error that you have from the example code we provide.
I'm going to close this issue for now as a duplicate. Thanks!
@admah , I'm afraid you closed this issue by mistake, my problem is not related to the "cannot be run in a non-interactive context" message (even though it is in the logs). If you look further and pay attention to the steps I mentioned, and look at the error message - you will notice that the problem is with the worker script template. As I managed to find out, a fetch hook must be present in the worker, which is absent in the example To put it simply - the template contains non-valid code, it lacks the export of fetch function
@Akiyamka the template is not wrong here, other than the need for a JSON.stringify
around one of the logged items. It is a valid scheduled Worker. The issue is related to some confusing error messaging that you're seeing. The browser has an automatic request for /favicon.ico
that is not being handled properly by us in this instance and causing the error.
In the meantime, you can test your scheduled Worker via wrangler dev --test-scheduled
and then run the scheduled event by visiting http://localhost:8787/__scheduled?cron=*+*+*+*+*
. You should see the logs in your CLI, and the proper response from the URL.
I have same issue
In my environment, did not give me an error via curl, but via browser did
i have the same issue on a fresh project initialized with npm create cloudflare@latest
and selected cron job worker template (windows 11)
same
same issue :(
Which Cloudflare product(s) does this pertain to?
Workers Runtime
What version(s) of the tool(s) are you using?
wrangler 3.19.0
What version of Node are you using?
v20.8.0
What operating system are you using?
Linux
Describe the Bug
Steps:
pnpm create cloudflare@latest
./daemon
type Scheduled Worker (Cron Trigger)
Yes
cd ./daemon
npx wrangler dev
Please provide a link to a minimal reproduction
No response
Please provide any relevant error logs