Reproduction
With @netscript/fresh@0.0.5, create a Fresh/Vite island using the documented factory without a baseUrl override:
createNetScriptStreamDB({
streamPath: '/workers/executions',
schema,
})
Run it from an Aspire AppHost that injects both canonical browser references into the dashboard process:
VITE_services__streams__http__0=http://localhost:4437
VITE_STREAMS_URL=http://localhost:4437
The island throws before connecting:
Durable streams URL not found. Expected DURABLE_STREAMS_URL or
services__streams__http__0 (server) / VITE_services__streams__http__0
(browser) in the environment.
Cause
getBrowserServiceEndpoint() calls readImportMetaEnvironment(import.meta). Vite substitutes import.meta.env expressions, but does not attach an env property to a bare import.meta passed through a helper, particularly in the JSR dependency module served by Fresh/Vite. Consequently, both injected variables are present in the process but invisible to the resolver in the browser bundle.
Expected
The documented zero-configuration browser factory should resolve Aspire's canonical Vite service reference and connect directly to Streams.
Temporary consumer path
Passing the factory's documented baseUrl override from a statically substituted application expression works:
baseUrl: import.meta.env.VITE_services__streams__http__0 ??
import.meta.env.VITE_STREAMS_URL
This keeps NetScript in control of the /v1/stream/netscript URL and transport, but duplicates discovery at each consumer. A package-side direct import.meta.env.VITE_* lookup (or a Vite-plugin transform) would remove that drift.
Reproduction
With
@netscript/fresh@0.0.5, create a Fresh/Vite island using the documented factory without abaseUrloverride:Run it from an Aspire AppHost that injects both canonical browser references into the dashboard process:
VITE_services__streams__http__0=http://localhost:4437VITE_STREAMS_URL=http://localhost:4437The island throws before connecting:
Cause
getBrowserServiceEndpoint()callsreadImportMetaEnvironment(import.meta). Vite substitutesimport.meta.envexpressions, but does not attach anenvproperty to a bareimport.metapassed through a helper, particularly in the JSR dependency module served by Fresh/Vite. Consequently, both injected variables are present in the process but invisible to the resolver in the browser bundle.Expected
The documented zero-configuration browser factory should resolve Aspire's canonical Vite service reference and connect directly to Streams.
Temporary consumer path
Passing the factory's documented
baseUrloverride from a statically substituted application expression works:This keeps NetScript in control of the
/v1/stream/netscriptURL and transport, but duplicates discovery at each consumer. A package-side directimport.meta.env.VITE_*lookup (or a Vite-plugin transform) would remove that drift.