According to the documentation, when creating a project with the Vue framework, it also creates an additional worker under server/index.js. I have written a worker that interacts with the D1 service in this file. When in development (npm run dev) the worker interacts with d1 without any problems. When deploying it to production (npm run deploy), the query function works as expected, but update function does not appear to be working. I have tried watching the logs and it appears to be exectuing the function as expected, but the database never reflects any of the updates
Here is the fetch function that retrieves the data that works as expected:
Here is the fetch function that writes updates. Works in dev but not in production: if (pathname === "/api/updates") { // console.log(params); params.forEach(async (value, key) => { // console.log(key, value); console.log(
UPDATE NxStage SET Qty = ${value} WHERE ID = ${key}
UPDATE NxStage SET Qty = ${value} WHERE ID = ${key}
) const { results } = await env.DB.prepare( "UPDATE NxStage SET Qty = ? WHERE ID = ?" ).bind(value, key).run() }); return new Response(null, { status: 200 }); }
Any help is greatly appreciated. I am sure I am missing something small. This one has me perplexed.