GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fix(deno): Fill module and trim trailing context line in stack frames by sentry-junior[bot] · Pull Request #26641 · getsentry/sentry-javascript

fix(deno): Fill module and trim trailing context line in stack frames #26641

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Sign up for GitHub

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
mydea merged 1 commit into develop from fix/deno-stack-frames
Nov 24, 2026
+51 −17
Merged

fix(deno): Fill module and trim trailing context line in stack frames #26641

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
1 commit
Select commit
863bd51
fix(deno): Fill module and trim trailing context line in stack frames
sentry-junior[bot] Nov 19, 2026
File filter
Filter by extension

Clear filters
Conversations
Failed to load comments.
Loading

Uh oh!

There was an error while loading. Please reload this page.

Jump to
Jump to file
Failed to load files.
Loading

Uh oh!

There was an error while loading. Please reload this page.

Diff view
Diff view

There are no files selected for viewing

11 changes: 0 additions & 11 deletions 11 dev-packages/deno-integration-tests/node-suites/excludes.ts
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -101,16 +101,6 @@ const NO_CLIENT_REPORTS = [
'suites/tracing/sampling/test.ts',
];

// The stack frames of `@sentry/deno` have no `module`, and some have other `function` names. Their
// `post_context` also ends with an extra empty line, and in CommonJS scenarios the line numbers can
// be off.
const STACK_FRAMES_DIFFER = [
'suites/contextLines/filename-with-spaces/test.ts',
'suites/public-api/captureException/catched-error/test.ts',
'suites/tracing/postgresjs-tracing-channel/test.ts',
'suites/tracing/postgresjs/test.ts',
];

export const NODE_SUITES_EXCLUDE = [
'**/node_modules/**',
...NODE_ONLY,
Expand All @@ -122,5 +112,4 @@ export const NODE_SUITES_EXCLUDE = [
...NO_NODE_DEFAULT_INTEGRATION,
...GLOBAL_HANDLERS_DIFFER,
...NO_CLIENT_REPORTS,
...STACK_FRAMES_DIFFER,
];
4 changes: 4 additions & 0 deletions 4 packages/deno/src/integrations/contextlines.ts
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,10 @@ async function addSourceContextToFrames(frames: StackFrame[], contextLines: numb
if (sourceFile) {
try {
const lines = sourceFile.split('\n');
// A trailing newline ends the last line, it does not start another one.
if (lines[lines.length - 1] === '') {
lines.pop();
}
addContextToFrame(lines, frame, contextLines);
} catch {
// anomaly, being defensive in case
Expand Down
9 changes: 7 additions & 2 deletions 9 packages/deno/src/sdk.ts
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,12 @@ import {
requestDataIntegration,
stackParserFromStackParserOptions,
} from '@sentry/core';
import { detectOrchestrionSetup, getTracingIntegrations, getErrorIntegrations } from '@sentry/server-utils';
import {
createGetModuleFromFilename,
detectOrchestrionSetup,
getTracingIntegrations,
getErrorIntegrations,
} from '@sentry/server-utils';
import { DenoClient } from './client';
import { nodeStackLineParser } from '@sentry/core/server';
import { breadcrumbsIntegration } from './integrations/breadcrumbs';
Expand Down Expand Up @@ -61,7 +66,7 @@ export function getDefaultIntegrations(options: Options): Integration[] {
return [...getDefaultIntegrationsWithoutPerformance(), ...(hasSpansEnabled(options) ? getTracingIntegrations() : [])];
}

const defaultStackParser: StackParser = createStackParser(nodeStackLineParser());
const defaultStackParser: StackParser = createStackParser(nodeStackLineParser(createGetModuleFromFilename()));

/**
* The Sentry Deno SDK Client.
Expand Down
27 changes: 27 additions & 0 deletions 27 packages/deno/test/contextlines.test.ts
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import type { Client, Event } from '@sentry/core';
import { assertEquals } from 'https://deno.land/[email protected]/assert/assert_equals.ts';
import { contextLinesIntegration } from '../build/esm/index.js';

Deno.test('does not add an empty line after the last line of a file to the context', async () => {
const filename = new URL(import.meta.url).pathname;
const lines = (await Deno.readTextFile(filename)).split('\n');
assertEquals(lines[lines.length - 1], '');
const lastLine = lines.length - 1;

const event: Event = {
exception: {
values: [{ stacktrace: { frames: [{ filename, lineno: lastLine, colno: 1, in_app: true }] } }],
},
};

const processed = await contextLinesIntegration({ frameContextLines: 2 }).processEvent?.(
event,
{},
undefined as unknown as Client,
);
const frame = processed?.exception?.values?.[0]?.stacktrace?.frames?.[0];

assertEquals(frame?.pre_context, lines.slice(lastLine - 3, lastLine - 1));
assertEquals(frame?.context_line, lines[lastLine - 1]);
assertEquals(frame?.post_context, []);
});
8 changes: 8 additions & 0 deletions 8 packages/deno/test/sdk.test.ts
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -120,3 +120,11 @@ Deno.test('getDefaultIntegrations is getDefaultIntegrationsWithoutPerformance pl
assertEquals(full.slice(0, base.length), base);
assertArrayIncludes(full.slice(base.length), ['Graphql', 'Postgres', 'OpenAI']);
});

Deno.test('the default stack parser fills the module of frames', () => {
const client = init({});
const frames = client
.getOptions()
.stackParser('Error\n at handle (file:///app/node_modules/postgres/src/connection.js:10:5)');
assertEquals(frames[0]?.module, 'postgres.src:connection');
});
2 changes: 1 addition & 1 deletion 2 packages/node/src/index.ts
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ export { workerThreadsIntegration } from './integrations/workerThreads';
export { NODE_VERSION } from './nodeVersion';
export { defaultStackParser, getSentryRelease } from './sdk/api';
export { getHttpAgent, makeNodeTransport } from './transports';
export { createGetModuleFromFilename } from './utils/module';
export { createGetModuleFromFilename } from '@sentry/server-utils';

export { eveConversationHook, eveIntegration, getInstrumentedModuleNames } from '@sentry/server-utils';
export { eveInstrumentation } from './eve';
Expand Down
2 changes: 1 addition & 1 deletion 2 packages/node/src/integrations/anr/worker.ts
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ import {
uuid4,
} from '@sentry/core';
import { callFrameToStackFrame, watchdogTimer } from '@sentry/core/server';
import { createGetModuleFromFilename } from '@sentry/server-utils';
import { makeNodeTransport } from '../../transports';
import { createGetModuleFromFilename } from '../../utils/module';
import type { WorkerStartData } from './common';

type VoidFunction = () => void;
Expand Down
2 changes: 1 addition & 1 deletion 2 packages/node/src/sdk/api.ts
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import type { StackParser } from '@sentry/core';
import { createStackParser, GLOBAL_OBJ } from '@sentry/core';
import { _INTERNAL_getReleaseFromCommitEnv as getReleaseFromCommitEnv, nodeStackLineParser } from '@sentry/core/server';
import { createGetModuleFromFilename } from '../utils/module';
import { createGetModuleFromFilename } from '@sentry/server-utils';

/**
* Returns a release dynamically from environment variables.
Expand Down
1 change: 1 addition & 0 deletions 1 packages/server-utils/src/index.ts
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ export {
makeServeTunnelIntegration,
} from './integrations/serveTunnel';
export { instrumentTunnelServer as _INTERNAL_instrumentTunnelServer } from './utils/tunnelServer';
export { createGetModuleFromFilename } from './utils/module';
export { SentryMastraExporter } from './ai/mastra';
export { lruMemoizerIntegration } from './integrations/lru-memoizer';
export { mongoIntegration } from './integrations/mongodb';
Expand Down
0 packages/node/src/utils/module.ts → packages/server-utils/src/utils/module.ts
Show comments
View file
Open in desktop
File renamed without changes.
2 changes: 1 addition & 1 deletion 2 packages/node/test/utils/module.test.ts → ...es/server-utils/test/utils/module.test.ts
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { describe, expect, it } from 'vitest';
import { createGetModuleFromFilename } from '../../src';
import { createGetModuleFromFilename } from '../../src/utils/module';

describe('createGetModuleFromFilename', () => {
it.each([
Expand Down
Loading
Oops, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

Add this suggestion to a batch that can be applied as a single commit. This suggestion is invalid because no changes were made to the code. Suggestions cannot be applied while the pull request is closed. Suggestions cannot be applied while viewing a subset of changes. Only one suggestion per line can be applied in a batch. Add this suggestion to a batch that can be applied as a single commit. Applying suggestions on deleted lines is not supported. You must change the existing code in this line in order to create a valid suggestion. Outdated suggestions cannot be applied. This suggestion has been applied or marked resolved. Suggestions cannot be applied from pending reviews. Suggestions cannot be applied on multi-line comments. Suggestions cannot be applied while the pull request is queued to merge. Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.