workers-sdk
workers-sdk copied to clipboard
🐛 BUG: d1 `first()` errors if no results are found
What version of Wrangler are you using?
d1
What operating system are you using?
macOS
Describe the Bug
At least in local mode, result is returned, rather than results, so the logic in the facade results.length crashes.
According to the docs an D1_NORESULTS error should be thrown if this is the case (not the generic error that's being produced here).
It seems now that local mode returns null, whereas remote mode returns D1_NORESULTS
Closing this issue as it looks like we fixed it in the lead up to developer week.
Local:
results: Object {
TOTAL: 0
}
Remote:
results: Object {
TOTAL: 0
}