cloudflare / cloudflare/workers-sdk
🐛 BUG: Invalid BEGIN TRANSACTION detection
- Dominant language
- TypeScript
- Stars
- 4.5k
- Forks
- 1.5k
- Avg merge
- 3d 8h
- Merged PRs (30d)
- 186
Description
### Which Cloudflare product(s) does this pertain to?
D1, Wrangler core
### What version(s) of the tool(s) are you using?
3.29.0 [wrangler]
### What version of Node are you using?
v20.11.1
### What operating system and version are you using?
Ubuntu 22.04.3 LTS
### Describe the Bug
### Observed behaviour
I tried to update a row in D1 by passing a string that contains the words _BEGIN TRANSACTION_ utilising the Wrangler D1 command `execute` and got the error below.
> ✘ [ERROR] Wrangler could not process the provided SQL file, as it contains several transactions.
### Expected behaviour
The row will be updated.
### Steps to reproduce
- No worker involved. I am running a Wrangler command against D1
- `wrangler.toml` is not relevant, since I am running a Wrangler command against D1, but here it is:
```
name = "ai"
main = "src/index.js"
compatibility_date = "2023-12-06"
```
- I am not running a local dev server
- To reproduce run from terminal the two bash commands below:
```bash
TEXT="You can''t refer to a table that doesn''t yet exist.\n* If you get \"cannot start a transaction within a transaction\", make sure you have removed \`BEGIN TRANSACTION\` and \`COMMIT\` from your dumped SQL statements."
npx wrangler d1 execute --local --command "UPDATE Nodes SET text=\"${TEXT}\" WHERE id=537;"
```
### Please provide a link to a minimal reproduction
_No response_
### Please provide any relevant error logs
_No response_
Contributor guide
Assessment
This issue has not been assessed yet.