Skip to content

Commit 1725135

Browse files
cursoragentclaude
andcommitted
fix(effect): Make server effectLayer lazy and add missing eslint-disable
- Wrap server effectLayer init call in suspendLayer to match client behavior - Add missing eslint-disable comment for import/export in index.server.ts Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
1 parent 0f2390f commit 1725135

File tree

3 files changed

+9
-2
lines changed

3 files changed

+9
-2
lines changed

packages/effect/src/index.server.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
// import/export got a false positive, and affects most of our index barrel files
2+
// can be removed once following issue is fixed: https://github.com/import-js/eslint-plugin-import/issues/703
3+
/* eslint-disable import/export */
14
export * from '@sentry/node-core/light';
25

36
export { effectLayer, init } from './server/index';

packages/effect/src/server/index.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import type { NodeOptions } from '@sentry/node-core/light';
22
import type * as EffectLayer from 'effect/Layer';
3+
import { suspend as suspendLayer } from 'effect/Layer';
34
import { buildEffectLayer } from '../utils/buildEffectLayer';
45
import { init } from './sdk';
56

@@ -35,5 +36,5 @@ export type EffectServerLayerOptions = NodeOptions;
3536
* ```
3637
*/
3738
export function effectLayer(options: EffectServerLayerOptions): EffectLayer.Layer<never, never, never> {
38-
return buildEffectLayer(options, init(options));
39+
return suspendLayer(() => buildEffectLayer(options, init(options)));
3940
}

packages/effect/test/layer.test.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,10 @@ describe.each([
4545
const metadata = client?.getOptions()._metadata?.sdk;
4646

4747
expect(metadata?.name).toBe('sentry.javascript.effect');
48-
expect(metadata?.packages).toEqual([{ name: 'npm:@sentry/effect', version: SDK_VERSION }, { name: `npm:@sentry/${subSdkName}`, version: SDK_VERSION }]);
48+
expect(metadata?.packages).toEqual([
49+
{ name: 'npm:@sentry/effect', version: SDK_VERSION },
50+
{ name: `npm:@sentry/${subSdkName}`, version: SDK_VERSION },
51+
]);
4952
}).pipe(
5053
Effect.provide(
5154
effectLayer({

0 commit comments

Comments
 (0)