Skip to content

fix: suppress console spam for chrome devtools requests #13830

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.

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
merged 4 commits into from
Jun 5, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/calm-dragons-visit.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@sveltejs/kit': patch
---

fix: suppress console spam for chrome devtools requests
17 changes: 17 additions & 0 deletions packages/kit/src/runtime/server/respond.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ const page_methods = new Set(['GET', 'HEAD', 'POST']);

const allowed_page_methods = new Set(['GET', 'HEAD', 'OPTIONS']);

let warned_on_devtools_json_request = false;

/**
* @param {Request} request
* @param {import('types').SSROptions} options
Expand Down Expand Up @@ -573,6 +575,21 @@ export async function respond(request, options, manifest, state) {
// if this request came direct from the user, rather than
// via our own `fetch`, render a 404 page
if (state.depth === 0) {
// In local development, Chrome requests this file for its 'automatic workspace folders' feature,
// causing console spam. If users want to serve this file they can install
// https://github.com/ChromeDevTools/vite-plugin-devtools-json
if (DEV && event.url.pathname === '/.well-known/appspecific/com.chrome.devtools.json') {
if (!warned_on_devtools_json_request) {
console.warn(
`\nGoogle Chrome is requesting ${event.url.pathname} to automatically configure devtools project settings. To serve this file, add this plugin to your Vite config:\n\nhttps://github.com/ChromeDevTools/vite-plugin-devtools-json\n`
);

warned_on_devtools_json_request = true;
}

return new Response(undefined, { status: 404 });
}

return await respond_with_error({
event,
options,
Expand Down
Loading