Skip to content

Outerbase Raw Endpoint Not Returning Errors For Cloudflare D1 #41

@caleb-mabry

Description

@caleb-mabry

Describe the bug
When trying to fix #33 the Outerbase API does not return any errors. I'm specifically working with an API key that is attached to a Cloudflare D1 interface.

Outerbase API said {
  success: true,
  response: {
    query: 'update table egg where egg = "egg"',
    results: { schema: false, items: [], count: 0 }
  }
}

I do not have a table called egg and this query should have issues. It also seems to be confusing because there is a success:true but the status code 200 should already let us know that it was OK.

To Reproduce
Steps to reproduce the behavior:
Update outerbase.ts to console log the response from the query function.
https://github.com/outerbase/sdk/blob/main/src/connections/outerbase.ts#L126-L128

        let json = await response.json()
        let error = null
        console.log('Outerbase API said', json)
import {OuterbaseConnection} from './src/connections/outerbase'
import {Outerbase} from './src/client'
const connection = new OuterbaseConnection({apiKey: 'YOUR-API-KEY-HERE'})
const outerbase = Outerbase(connection);


(async () => {
    const response = await outerbase.queryRaw('update table egg where egg = "egg"')
    console.log('Response from IIFE', response)
})()

Expected behavior
I would expect Outerbase to let me know there is an error in my query but it silently fails.

Screenshots
If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):
N/A

Smartphone (please complete the following information):
N/A

Additional context
Add any other context about the problem here.

Metadata

Metadata

Labels

bugSomething isn't workinginternal

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions