| outline | deep |
|---|
Package:
@vitejs/devtools-rpc
Function "
{name}" not found in dump store
This error is thrown by createClientFromDump() when you call a function on the dump client that was not included in the definitions passed to dumpFunctions(). The dump store only contains entries for functions that were part of the original dump collection, and the client rejects calls to unknown functions.
import { defineRpcFunction } from '@vitejs/devtools-kit'
import { createClientFromDump, dumpFunctions } from '@vitejs/devtools-rpc'
const getVersion = defineRpcFunction({
name: 'my-plugin:get-version',
type: 'static',
handler: () => '1.0.0',
})
// Only getVersion is dumped
const store = await dumpFunctions([getVersion])
const client = createClientFromDump(store)
// Throws DTK0005 because 'my-plugin:get-config' is not in the store
await client['my-plugin:get-config']()Include the function in the definitions array passed to dumpFunctions():
const getConfig = defineRpcFunction({
name: 'my-plugin:get-config',
type: 'query',
handler: () => ({ debug: false }),
dump: { inputs: [[]] },
})
// Include all needed functions in the dump
const store = await dumpFunctions([getVersion, getConfig])
const client = createClientFromDump(store)
// Now both functions work
await client['my-plugin:get-version']()
await client['my-plugin:get-config']()packages/rpc/src/dumps.ts