apache / superset

Apache Superset is a Data Visualization and Data Exploration Platform
https://superset.apache.org/
Apache License 2.0
61.33k stars 13.36k forks source link

Content not from webpack is served from 'D:\tech_release\superset-fork\superset\static\assets' directory #28632

Closed duniang818 closed 3 weeks ago

duniang818 commented 3 months ago

Bug description

npm run dev-server on windows 10 lastest superset 4.0.1 npm: 10.2.4 node: 18.19.1 python: 3.11.5

How to reproduce the bug

  1. cd D:\tech_release\superset-fork\superset-frontend

  2. webpack.config.js config is:

  3. webpack config js

  4. npm install

  5. npm run dev-server

  6. npm run dev-server

  7. the result from browser:

Screenshots/recordings

No response

Superset version

4.0.1

Python version

3.11

Node version

18 or greater

Browser

Chrome

Additional context

No response

Checklist

dosubot[bot] commented 3 months ago

To resolve the issue with the error message "Content not from webpack is served from 'D:\tech_release\superset-fork\superset\static\assets' directory" when running npm run dev-server on Windows 10 with Superset version 4.0.1, ensure that the static directory is correctly referenced in your webpack.config.js file.

Steps to Verify and Fix the Issue

  1. Verify Directory Structure: Ensure that the directory D:\tech_release\superset-fork\superset\static\assets exists and contains the necessary static assets.

  2. Adjust Path if Necessary: If the directory structure is different, adjust the path in the webpack.config.js file. For example:

    if (isDevMode) {
     config.devServer = {
       static: path.join(__dirname, 'path/to/your/static/assets'),
     };
    }

    Replace 'path/to/your/static/assets' with the actual path to your static/assets directory.

  3. Check Permissions: Ensure you have the necessary permissions to access the directory on your Windows 10 system.

Proxy Configuration

The error "Error occurred while trying to proxy: localhost:9000" suggests an issue with the proxy configuration:

  1. Backend Server Not Running: Ensure the Superset backend server is running on the expected port (default is 8088). Start the server using superset run -p 8088.

  2. Incorrect Backend URL or Port: Verify the backend URL and port in the webpack.proxy-config.js file:

    const { supersetPort = 8088, superset: supersetUrl = null } = parsedEnvArg();
    const backend = (supersetUrl || `http://localhost:${supersetPort}`).replace(
     '//+$/',
     '',
    );

    Ensure supersetPort is set to the correct port where the Superset backend is running.

  3. Network Issues: Check your network connection and ensure there are no firewalls or other network configurations blocking the connection to localhost:8088.

  4. Proxy Configuration Errors: Review the proxy configuration for any syntax errors or misconfigurations. The configuration should look like this:

    module.exports = newManifest => {
     manifest = newManifest;
     return {
       context: '/',
       target: backend,
       hostRewrite: true,
       changeOrigin: true,
       cookieDomainRewrite: '', // remove cookie domain
       selfHandleResponse: true, // so that the onProxyRes takes care of sending the response
       onProxyRes(proxyResponse, request, response) {
         try {
           copyHeaders(proxyResponse, response);
           if (isHTML(response)) {
             processHTML(proxyResponse, response);
           } else {
             proxyResponse.pipe(response);
           }
           response.flushHeaders();
         } catch (e) {
           response.setHeader('content-type', 'text/plain');
           response.write(`Error requesting ${request.path} from proxy:\n\n`);
           response.end(e.stack);
         }
       },
     };
    };

By addressing these common causes, you should be able to resolve the issues with the development server and proxy configuration in Superset. If you continue to experience problems, please provide additional details about the directory structure and any specific error messages you encounter.

#### Details **Sources** - [npm run dev-server, Content not from webpack is served from 'D:\tech_release\superset-fork\static\assets' directory](https://github.com/apache/superset/discussions/28631) - [RpcIpcMessagePortClosedError](https://github.com/apache/superset/discussions/18334) - [superset 2.1.0 frontend start to use the "npm run dev-server", will appear many warnings](https://github.com/apache/superset/discussions/27235) - [superset 2.1.0 frontend start to use the "npm run dev-server", will appear many warnings ](https://github.com/apache/superset/issues/27227) - [superset-frontend/webpack.config.js](https://github.com/apache/superset/blob/master/superset-frontend/webpack.config.js) - [pyproject.toml](https://github.com/apache/superset/blob/master/pyproject.toml) - [superset-frontend/webpack.proxy-config.js](https://github.com/apache/superset/blob/master/superset-frontend/webpack.proxy-config.js)
**About Dosu** This response is meant to be useful and save you time. It is **not meant to be a precise solution**, but rather a starting point for your own research. Help me be more useful! Please leave a 👍 if this is helpful and 👎 if it is irrelevant.

To continue the conversation, mention @dosu.

duniang818 commented 3 months ago
  1. i have checked the config file both webpack.config.js, webpack.proxy-config.js and superest_config.py, there everything is ok, i don't find something is wrong.

  2. the assets exist in the dir D:\tech_release\superset-fork\superset\static\assets.

  3. the structure is : D:\tech_release\superset-fork D:\tech_release\superset-fork\superset PS D:\tech_release\superset-fork\superset superset run -p 8088 D:\tech_release\superset-fork\superset\superset_config.py D:\tech_release\superset-fork\superset\static\assets D:\tech_release\superset-fork\superset-frontend PS D:\tech_release\superset-fork\superset-frontend npm install && npm run dev-server D:\tech_release\superset-fork\superset-frontend\webpack.config.js D:\tech_release\superset-fork\superset-frontend\webpack.proxy-config.js D:\tech_release\superset-fork\superset-frontend\package.json

  4. everything is above, but don't work now.

duniang818 commented 3 months ago
  1. i have checked the config file both webpack.config.js, webpack.proxy-config.js and superest_config.py, there everything is ok, i don't find something is wrong.

  2. the assets exist in the dir D:\tech_release\superset-fork\superset\static\assets.

  3. the structure is : D:\tech_release\superset-fork D:\tech_release\superset-fork\superset PS D:\tech_release\superset-fork\superset superset run -p 8088 D:\tech_release\superset-fork\superset\superset_config.py D:\tech_release\superset-fork\superset\static\assets D:\tech_release\superset-fork\superset-frontend PS D:\tech_release\superset-fork\superset-frontend npm install && npm run dev-server D:\tech_release\superset-fork\superset-frontend\webpack.config.js D:\tech_release\superset-fork\superset-frontend\webpack.proxy-config.js D:\tech_release\superset-fork\superset-frontend\package.json

  4. everything is above, but don't work now.

duniang818 commented 3 months ago
static: path.join(__dirname, '../superset/static/assets'),

const { supersetPort = 8088, superset: supersetUrl = null } = parsedEnvArg(); const backend = (supersetUrl || http://localhost:${supersetPort}).replace( '//+$/', '', ); // strip ending backslash

duniang818 commented 3 weeks ago

前端编译后就可以了。 全部前后端Windows源码部署请参考:https://zhuanlan.zhihu.com/p/710483750