Skip to content

Instantly share code, notes, and snippets.

@pigoz
Created December 22, 2022 10:13
Show Gist options
  • Save pigoz/5e9db959ca42ad8cecae75383a105c1e to your computer and use it in GitHub Desktop.
Save pigoz/5e9db959ca42ad8cecae75383a105c1e to your computer and use it in GitHub Desktop.
There was an error running the data loader for route routes/dashboard.posts
Error: Service not found
at /Users/pigoz/dev/superagent/node_modules/src/internal/Context.ts:130:13
at Object.successK (/Users/pigoz/dev/superagent/node_modules/@effect/io/src/internal/core.ts:915:60)
at Object.4 (/Users/pigoz/dev/superagent/node_modules/@effect/io/src/internal/fiberRuntime.ts:96:17)
at FiberRuntime.6 (/Users/pigoz/dev/superagent/node_modules/@effect/io/src/internal/fiberRuntime.ts:980:36)
at FiberRuntime.runLoop (/Users/pigoz/dev/superagent/node_modules/@effect/io/src/internal/fiberRuntime.ts:1173:47)
at FiberRuntime.evaluateEffect (/Users/pigoz/dev/superagent/node_modules/@effect/io/src/internal/fiberRuntime.ts:785:29)
at FiberRuntime.start (/Users/pigoz/dev/superagent/node_modules/@effect/io/src/internal/fiberRuntime.ts:840:14)
at RuntimeImpl.unsafeRunWith (/Users/pigoz/dev/superagent/node_modules/@effect/io/src/internal/runtime.ts:98:18)
at RuntimeImpl.unsafeRunAsyncWith (/Users/pigoz/dev/superagent/node_modules/@effect/io/src/internal/runtime.ts:178:10)
at /Users/pigoz/dev/superagent/node_modules/@effect/io/src/internal/runtime.ts:185:12
GET /dashboard/posts 500 - - 96.003 ms
import * as Z from '@effect/io/Effect';
import { pipe } from '@fp-ts/data/Function';
import {
makeAppRuntime,
makeDataFunction,
RemixEffectAppRuntime,
} from 'remix-effect';
import { AppLayer, appLayerLive } from './layer';
let runtime: Promise<RemixEffectAppRuntime<AppLayer>>;
declare global {
var __runtime: Promise<RemixEffectAppRuntime<AppLayer>> | undefined;
}
function make() {
const runtime = Z.unsafeRunPromise(makeAppRuntime(appLayerLive));
process.on('beforeExit', () =>
Z.unsafeRunPromise(
pipe(
Z.promise(() => runtime),
Z.flatMap(_ => _.clean),
),
),
);
return runtime;
}
if (process.env.NODE_ENV === 'production') {
runtime = make();
} else {
if (!global.__runtime) {
global.__runtime = make();
}
runtime = global.__runtime;
}
const run = makeDataFunction(runtime);
export { run };
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment