cloudflare / cloudflare/developer-platform
Errors when running sqlite files with D1 are very unhelpful
- Vorherrschende Sprache
- Keine Sprachdaten
- Sterne
- 1
- Forks
- 0
- PR-Merge-Kennzahlen
- Keine gemergten PRs in 30 T.
Beschreibung
### What versions & operating system are you using?
wrangler 4.26.0, macos
### Please provide a link to a minimal reproduction
_No response_
### Describe the Bug
Here's the output I see now when I have a simple bug in my sql syntax
```
0 ➤ npx wrangler@latest d1 execute pydantic-test --local --file=schema.sql
⛅️ wrangler 4.26.0
───────────────────
🌀 Executing on local database pydantic-test (test) from .wrangler/state/v3/d1:
🌀 To execute on your remote database, add a --remote flag to your wrangler command.
✘ [ERROR] near "limit": syntax error at offset 205: SQLITE_ERROR
If you think this is a bug then please create an issue at https://github.com/cloudflare/workers-sdk/issues/new/choose
? Would you like to report this error to Cloudflare? Wrangler's output and the error details will be shared with the Wrangler team to help us diagnose and fix the issue. › (Y/n)
```
1. The error gives an offset, not a line number
2. The offset is relative the expression, not the file - making it almost impossible to use!
3. The incorrect code is not show
4. You're constantly suggesting I create issues when I just have an error in my sql syntax
Compare this to the error I get from sqlite:
```
➤ sqlite3 test.edb < schema.sql
Parse error near line 77: near "limit": syntax error
lete old usage beyond one month CHECK (usage <= limit) );
error here ---^
```
### Please provide any relevant error logs
_No response_
Beitragsleitfaden
Rechercherichtung
Reproduziere zunächst `npx wrangler@latest d1 execute ... --local --file=schema.sql` mit dem beschriebenen fehlerhaften SQL und vergleiche anschließend die Ausgabe mit dem sqlite3-Beispiel. Verfolge den Einstiegspunkt für die lokale D1-Fehlerberichterstattung; die Aufgabe ist abgeschlossen, wenn Syntaxfehler die relativ zur Datei angegebene Zeile identifizieren, den relevanten SQL-Kontext anzeigen und die Aufforderung zur Meldung des Problems vermeiden.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- sql, sqlite
- Bereich
- cli, databases
- Issue-Typ
- Bug
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 3-5 Tage
- Aktivitätsstatus
- Veraltet
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 35/100