Cloudflare D1 Database is not recognized as it inside a worker
Hello guys,
I have created a worker which helps me to execute a cron which read data from a specific KV, and for each of those data make an API call and save the result into a database.
The response saved match the following interface:
I have created a class to handle the database related operations and it was working very well. see database file.
So as I said it was working very well, but as API call was too much I decided to include a Durable object to execute my API calls in queue. I added then the following line to the entry point file:
And for my d1 and durable object configuration in my wrangler toml I added those lines:
However, after having added the durable object to it, at the step of the database insertion data I get the error "Error: TypeError: dba.prepare is not a function".
When I stringify the D1 database to inspect it I get the following object:
Can someone help me resolve the issue please ?
Thanks,
0 Replies