68

I have an app with Remix and Prisma. On the server side console I get this error:

 status: 404,
 statusText: 'Not Found',
 internal: true,
 data: 'Error: No route matches URL "/.well- known/appspecific/com.chrome.devtools.json"',
 error: Error: No route matches URL "/.well-known/appspecific/com.chrome.devtools.json"

Seems like something from chrome dev tools.

How can I prevent this request?

The stack:

"@remix-run/node": "^2.15.3",
"@remix-run/react": "^2.15.3",
"@remix-run/serve": "^2.15.3",
"isbot": "^4.1.0",
"prisma": "^6.8.2",
"react": "^18.2.0",
"react-dom": "^18.2.0"
1

3 Answers 3

96

This is a request made by Chrome's DevTools as part of the Automatic Workspace Folders feature:

devservers can inform the developer tools running in the browser about the project folders that they are serving, and DevTools can automatically pick that up and connect to these folders during local debugging, and automatically disconnect these folders when the developer navigates somewhere else.

To disable it, you have to open chrome://flags/#devtools-project-settings in your Chrome browser and disable the flag, then restart the browser (reopening tab does NOT work!)

There’s nothing you can do server-side to prevent this request; if you don’t want to have it hit your app, block it in nginx or whatever reverse-proxy you’re using. If you do want to support it, you can create the route by hand, or use a plugin such as vite-plugin-devtools-json. For instructions specific to Svelte, see their official documentation.

Sign up to request clarification or add additional context in comments.

Comments

8

Although @bfontaine's answer worked, I wanted to use the feature, so I added this to my remix routes:

[.]well-known.appspecific.[com.chrome.devtools.json].tsx

Just to clarify the routes folder looks like this:

app/
├── routes/
│   ├── [.]well-known.appspecific.[com.chrome.devtools.json].tsx
│   ├── other.routes...
|   ├── other.routes...
└── root.tsx

And in the file itself:

import type { LoaderFunctionArgs } from '@remix-run/node';
import path from 'path';

export const loader = async ({request}: LoaderFunctionArgs) => {
    // From the Node docs on path.resolve(): 
    // If no path segments are passed, path.resolve() will return
    // the absolute path of the current working directory.
    const projectRoot = path.resolve()
    const jsonData = {
       workspace: {
           root: projectRoot,
           uuid: 'my-uuid-xxx',
       }
    };
    return Response.json(jsonData);
};

2 Comments

React router 7.6.0. I have created: [com.chrome.devtools.json].tsx And app/routes.ts: export default [ route( "/.well-known/appspecific/com.chrome.devtools.json", "routes/[com.chrome.devtools.json].tsx" ), ] satisfies RouteConfig;
You could also return a simple Response.json({})
1

Not so clear, but editing HTML/CSS/JS from the debugger inspector tool won't edit files, so it's quite middy useful in my opinion. It's just an editor.

This call /.well-known/appspecific/com.chrome.devtools.json does trigger only on the domain localhost.

Files could only be edited from the "workspace" tab in the debugger.

chrome debugger workspace

By the way, It is not necessary to add a JSON, as it is possible to add a root directory manually from there.

However, for automation, without creating the JSON manually and keep the workspace open after browser closes, we could create this file tree in the project directory, and after that it's a drop-in in any directory:

Example is PHP, adapting to any language is straightforward.

├── .well-known
│   └── appspecific
│       └── com.chrome.devtools.json
│           ├── index.php
│           └── uuid.txt (will be created automatically)

Where index.php looks like:

<?php

header("Content-Type: application/json; charset=UTF-8");

if (!file_exists("uuid.txt")){
    
    function uuidv4()
    {
      $data = random_bytes(16);
    
      $data[6] = chr(ord($data[6]) & 0x0f | 0x40); // set version to 0100
      $data[8] = chr(ord($data[8]) & 0x3f | 0x80); // set bits 6-7 to 10
        
      return vsprintf('%s%s-%s-%s-%s-%s%s%s', str_split(bin2hex($data), 4));
    }
    
    file_put_contents("uuid.txt", uuidv4());    
}


echo json_encode(["workspace" => ["root" => dirname(__FILE__,4), "uuid" => file_get_contents("uuid.txt")]]);

This makes the directory appears in workspace, it still require to press connect.

Chromium Workspace from JSON

Most infos in this page: https://developer.chrome.com/docs/devtools/workspaces

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.