Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Export DB throw error. #75

Open
portguas opened this issue May 8, 2024 · 0 comments
Open

Export DB throw error. #75

portguas opened this issue May 8, 2024 · 0 comments

Comments

@portguas
Copy link

portguas commented May 8, 2024

I'm using absurd-sql in electron.
I export the db like this.

try {
      const db = await getInstance()
      const data = db.export()
      const blob = new Blob([data], { type: 'application/octet-stream' })
      const blobHref = URL.createObjectURL(blob)

      self.postMessage({ action: 'exportedDB', blobHref })
    } catch (error) {
      console.info('sql export error, return ', error)
    }

It got error.

sql export error, return  TypeError: Cannot read properties of undefined (reading 'constructor')
    at readChunks (indexeddb-backend.js:65:20)
    at File.read (indexeddb-backend.js:248:22)
    at Object.read (index.js:101:37)
    at Object.read (sql-wasm.js:151:211)
    at Object.readFile (sql-wasm.js:154:349)
    at c.export (sql-wasm.js:88:238)
    at self.onmessage (instance.ts?type=mod…er_file? [sm]:86:23)

The error caused by const data = db.export()
In indexeddb-backend.js ,the data in undefined.

if (chunk.data.constructor.name !== 'ArrayBuffer') {
     throw new Error('Chunk data is not an ArrayBuffer');
   }

How can i resolve it. Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant