Skip to content

Using $inspect rune with remote functions causes internal error in the build #17514

@sukeshpabolu

Description

@sukeshpabolu

Describe the bug

Using $inspect rune with remote functions in a page is causing internal error when the build is run.

Reproduction

Enable experimental async and remoteFunctions

import adapter from '@sveltejs/adapter-node';

/** @type {import('@sveltejs/kit').Config} */
const config = {
	kit: {
		adapter: adapter(),
		experimental: {
			remoteFunctions: true
		}
	},
	compilerOptions: {
		sourcemap: process.env.NODE_ENV === 'development',
		experimental: {
			async: true
		}
	}
};

export default config;

Create a remote function

//$lib/remote/items.remote.js

import { query } from '$app/server';

export const getItem = query(() => {
	return {
		x: "Hello World"
	}
});

Create +page.svelte file

<script lang="ts">
    //./src/routes/items/+page.svelte
	import { getItem } from '$lib/remote/items.remote.js';

	const item = $derived(await getItem());
	let a = $state(5);
    //comment below line if the build has to work properly
	$inspect(a);
</script>

<br />

<button onclick={() => {a++}}>
	incr
</button>
<br />
{item.x}
<br />
{a}

Logs

[500] GET /items
TypeError: fn is not a function
    at file:///C:/Users/sukeshp/Documents/remote-inspect-bug-app/.svelte-kit/output/server/chunks/index.js:747:18
    at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
    at async Promise.all (index 0)

System Info

System:
    OS: Windows 10 10.0.19045
    CPU: (8) x64 11th Gen Intel(R) Core(TM) i5-1145G7 @ 2.60GHz
    Memory: 3.11 GB / 15.73 GB
  Binaries:
    Node: 22.21.1 - C:\Users\sukeshp\nodejs\node.EXE
    npm: 10.9.4 - C:\Users\sukeshp\nodejs\npm.CMD
    pnpm: 10.28.0 - C:\Users\sukeshp\AppData\Local\pnpm\pnpm.CMD
    bun: 1.3.5 - C:\Users\sukeshp\.bun\bin\bun.EXE
    Deno: 2.5.4 - C:\Users\sukeshp\.deno\bin\deno.EXE
  Browsers:
    Edge: Chromium (143.0.3650.80)
    Firefox: 133.0.3 - C:\Program Files\Mozilla Firefox\firefox.exe
    Internet Explorer: 11.0.19041.5794
  npmPackages:
    @sveltejs/adapter-node: ^5.5.1 => 5.5.1
    @sveltejs/kit: ^2.50.0 => 2.50.0
    @sveltejs/vite-plugin-svelte: ^6.2.4 => 6.2.4
    svelte: ^5.48.0 => 5.48.0
    vite: ^7.3.1 => 7.3.1

Severity

annoyance

Additional Information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions