Skip to content

Conversation

@BastiDood
Copy link
Contributor

This PR fixes a bug on Windows where SvelteKit incorrectly generates the wrong import path for the instrumentation.server.ts file. This practically broke the OpenTelemetry integration on Windows because the instrumentation.server.ts never gets called in both dev and preview.

// Expected
import './server/instrumentation.server.js';
// Actual
import './server/instrumentation\server.js';

The fix was pretty simple: posixify the relative_instrumentation path. I was unsure whether to use node:path/posix or the existing posixify utility, so I chose the latter to err on the side of existing conventions. Let me know if the former is preferred.


Tests

  • Run the tests with pnpm test and lint the project with pnpm lint and pnpm check

Changesets

  • If your PR makes a change that should be noted in one or more packages' changelogs, generate a changeset by running pnpm changeset and following the prompts. Changesets that add features should be minor and those that fix bugs should be patch. Please prefix changeset messages with feat:, fix:, or chore:.

Edits

  • Please ensure that 'Allow edits from maintainers' is checked. PRs without this option may be closed.

@changeset-bot
Copy link

changeset-bot bot commented Nov 26, 2025

🦋 Changeset detected

Latest commit: d40f12f

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@sveltejs/kit Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@BastiDood
Copy link
Contributor Author

Not sure why only one of the CI runs timed out, but I think it's safe to retry?

@teemingc
Copy link
Member

teemingc commented Dec 3, 2025

Thanks! I'm curious why this wasn't caught by our Windows tests. Do we need to adjust them or add something?
cc: @elliott-with-the-longest-name-on-github

@elliott-with-the-longest-name-on-github
Copy link
Contributor

I'm really not sure... I think it should be running on Windows (test-basics has instrumentation.server.ts and AFAICT it should be getting loaded by cross-platform... but I don't have a Windows machine and don't have the ability to tinker with it. I'm going to go ahead and merge this PR but also open an issue to hopefully fix this in the future.

@elliott-with-the-longest-name-on-github elliott-with-the-longest-name-on-github merged commit 08a153b into sveltejs:main Dec 3, 2025
22 checks passed
@github-actions github-actions bot mentioned this pull request Dec 3, 2025
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