Skip to content

fix(kit): ensure instrumentation file is posixified on Windows - #14993

Merged
elliott-with-the-longest-name-on-github merged 3 commits into
sveltejs:mainfrom
BastiDood:fix/instrumentation-file
Dec 3, 2025
Merged

elliott-with-the-longest-name-on-github merged 3 commits into
sveltejs:mainfrom
BastiDood:fix/instrumentation-file

Conversation

@BastiDood

Copy link
Copy Markdown
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

changeset-bot Bot commented Nov 26, 2025 •

Copy link
Copy Markdown

🦋 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
Copy Markdown
Contributor Author

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

Comment thread .changeset/old-boxes-rhyme.md Outdated
@teemingc

teemingc commented Dec 3, 2025

Copy link
Copy Markdown
Member

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
Copy Markdown
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
Copilot AI pushed a commit to Stadly/kit that referenced this pull request Mar 6, 2026
…ejs#14993)

* fix: ensure correct instrumentation file name on Windows

* chore: add changeset file

* Apply suggestion from @teemingc

---------

Co-authored-by: Tee Ming <chewteeming01@gmail.com>
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