mock-file
mock-file copied to clipboard
originalFunc is not a function
I'm using [email protected] with [email protected] on Deno Deploy with the fresh framework. I get this error:
An error occured during route handling or page rendering. TypeError: originalFunc is not a function
at Object.openSync (https://deno.land/x/[email protected]/src/polyfill.ts:120:20)
at js_open (https://deno.land/x/[email protected]/build/vfs.js:29:24)
at denoOpen (wasm://wasm/002a4c4a:1:3005)
at sqlite3PagerSharedLock (wasm://wasm/002a4c4a:1:30327)
at sqlite3BtreeBeginTrans (wasm://wasm/002a4c4a:1:24816)
at sqlite3InitOne (wasm://wasm/002a4c4a:1:157318)
at sqlite3Init (wasm://wasm/002a4c4a:1:156554)
at sqlite3ReadSchema (wasm://wasm/002a4c4a:1:100815)
at sqlite3LocateTable (wasm://wasm/002a4c4a:1:98255)
at sqlite3LocateTableItem (wasm://wasm/002a4c4a:1:245062)
Running it locally works fine.
First of all, thank you for your interest in this module!👍
I think I've also encountered this error. The solution at that time was:
The sqlite module will try to write to the journal file. Therefore, it is necessary to prepare a writable temporary file using prepareVirtualFile.
import {
prepareLocalFile,
prepareVirtualFile,
} from "https://deno.land/x/mock_file@$VERSION/mod.ts";
const dbFileName = "./db.sqlite";
await prepareLocalFile(dbFileName);
prepareVirtualFile(`${dbFileName}-journal`); // <- This line is needed!
We apologize if you have already done this. In that case, could you please provide the code that can reproduce the error?
I will work to improve this error message. (For example like Error: cannot open ${fileName} because...)
This fixed the issue for me, thank you! Thank you for making this module!