Skip to content

Conversation

@isaacs
Copy link
Member

@isaacs isaacs commented Nov 26, 2025

Fix JS-1216

Before submitting a pull request, please take a look at our
Contributing guidelines and verify:

  • If you've added code that should be tested, please add tests.
  • Ensure your code lints and the test suite passes (yarn lint) & (yarn test).

@linear
Copy link

linear bot commented Nov 26, 2025

@isaacs isaacs requested a review from RulaKhaled November 26, 2025 07:02
isaacs added a commit that referenced this pull request Nov 26, 2025
@isaacs isaacs force-pushed the isaacschlueter/js-1216-js-vercel-ai-sdk-attributes-missing branch from e14c708 to 830aa2e Compare November 26, 2025 07:03
@github-actions
Copy link
Contributor

github-actions bot commented Nov 26, 2025

size-limit report 📦

Path Size % Change Change
@sentry/browser 24.8 kB - -
@sentry/browser - with treeshaking flags 23.31 kB - -
@sentry/browser (incl. Tracing) 41.54 kB - -
@sentry/browser (incl. Tracing, Profiling) 46.13 kB - -
@sentry/browser (incl. Tracing, Replay) 79.96 kB - -
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 69.69 kB - -
@sentry/browser (incl. Tracing, Replay with Canvas) 84.64 kB - -
@sentry/browser (incl. Tracing, Replay, Feedback) 96.88 kB - -
@sentry/browser (incl. Feedback) 41.48 kB - -
@sentry/browser (incl. sendFeedback) 29.49 kB - -
@sentry/browser (incl. FeedbackAsync) 34.47 kB - -
@sentry/react 26.52 kB - -
@sentry/react (incl. Tracing) 43.74 kB - -
@sentry/vue 29.25 kB - -
@sentry/vue (incl. Tracing) 43.34 kB - -
@sentry/svelte 24.82 kB - -
CDN Bundle 27.21 kB - -
CDN Bundle (incl. Tracing) 42.21 kB - -
CDN Bundle (incl. Tracing, Replay) 78.75 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) 84.2 kB - -
CDN Bundle - uncompressed 79.96 kB - -
CDN Bundle (incl. Tracing) - uncompressed 125.34 kB - -
CDN Bundle (incl. Tracing, Replay) - uncompressed 241.37 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 254.13 kB - -
@sentry/nextjs (client) 45.96 kB - -
@sentry/sveltekit (client) 41.9 kB - -
@sentry/node-core 51.27 kB +0.01% +2 B 🔺
@sentry/node 159.56 kB +0.08% +127 B 🔺
@sentry/node - without tracing 92.85 kB +0.01% +2 B 🔺
@sentry/aws-serverless 108.14 kB +0.01% +1 B 🔺

View base workflow run

@github-actions
Copy link
Contributor

github-actions bot commented Nov 26, 2025

node-overhead report 🧳

Note: This is a synthetic benchmark with a minimal express app and does not necessarily reflect the real-world performance impact in an application.

Scenario Requests/s % of Baseline Prev. Requests/s Change %
GET Baseline 9,056 - 9,103 -1%
GET With Sentry 1,696 19% 1,718 -1%
GET With Sentry (error only) 6,142 68% 6,014 +2%
POST Baseline 1,205 - 1,178 +2%
POST With Sentry 603 50% 595 +1%
POST With Sentry (error only) 1,080 90% 1,027 +5%
MYSQL Baseline 3,278 - 3,240 +1%
MYSQL With Sentry 504 15% 496 +2%
MYSQL With Sentry (error only) 2,657 81% 2,691 -1%

View base workflow run

isaacs added a commit that referenced this pull request Nov 26, 2025
Also, sort the fields in the integration test, in order to more easily
se which fields were missing/misnamed in the fixture objects.

Fix JS-1216
@isaacs isaacs force-pushed the isaacschlueter/js-1216-js-vercel-ai-sdk-attributes-missing branch from 830aa2e to f5b9b31 Compare November 26, 2025 22:39
Copy link
Member

@RulaKhaled RulaKhaled left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The logic lgtm, I left some quick comments. We also need to a. update tests for Vercel v5 (it's a nested folder within vercel node integration tests) and b. run yarn fix in the root folder to fix lint issues

@isaacs isaacs force-pushed the isaacschlueter/js-1216-js-vercel-ai-sdk-attributes-missing branch from f5b9b31 to 346d3b3 Compare December 1, 2025 23:50
Comment on lines +129 to +139
}
const prompt = attributes[AI_PROMPT_ATTRIBUTE];
if (
typeof prompt === 'string' &&
!attributes[GEN_AI_REQUEST_MESSAGES_ATTRIBUTE] &&
!attributes[AI_PROMPT_MESSAGES_ATTRIBUTE]
) {
const messages = convertPromptToMessages(prompt);
if (messages.length) span.setAttribute(GEN_AI_REQUEST_MESSAGES_ATTRIBUTE, getTruncatedJsonString(messages));
}
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: The createRunner() function call is missing an await keyword, causing runner to be a Promise.
Severity: HIGH | Confidence: High

🔍 Detailed Analysis

If createRunner() returns a Promise, then runner without await would be a Promise object, not the resolved value. Calling .expect() directly on a Promise object would result in a runtime error similar to 'TypeError: runner.expect is not a function' because Promises do not have an .expect() method. This causes the integration test to fail at runtime when executed, preventing verification of Vercel AI span attributes.

💡 Suggested Fix

Add the await keyword before the createRunner() call: const runner = await createRunner().

🤖 Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent.
Verify if this is a real issue. If it is, propose a fix; if not, explain why it's not
valid.

Location: packages/core/src/tracing/vercel-ai/utils.ts#L93-L139

Potential issue: If `createRunner()` returns a Promise, then `runner` without `await`
would be a Promise object, not the resolved value. Calling `.expect()` directly on a
Promise object would result in a runtime error similar to 'TypeError: runner.expect is
not a function' because Promises do not have an `.expect()` method. This causes the
integration test to fail at runtime when executed, preventing verification of Vercel AI
span attributes.

Did we get this right? 👍 / 👎 to inform future reviews.
Reference ID: 4693704

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants