From bc42861cbfa00d6cff487d05a93c0a5cd47b8401 Mon Sep 17 00:00:00 2001 From: Benoit Lemaire Date: Thu, 16 Jun 2016 14:16:22 -0700 Subject: [PATCH] Cleanup packager dead debug endpoint Summary: When trying to access the debug dependency graph through the `/debug/graph` endpoint of the packager server (documented in the packager README and listed as well when hitting the root `/debug` endpoint), all I am getting back is a nasty HTTP 500 error :'( What triggers this HTTP 500 is a `TypeError` being thrown while trying to access a function that doesn't exists (anymore). Here is the error log of the packager when trying to access this endpoint : ``` TypeError: this._depGraph.getDebugInfo is not a function at Resolver.getDebugInfo (index.js:270:27) at Bundler.getGraphDebugInfo (index.js:575:27) at Server._processDebugRequest (index.js:369:28) at Server.processRequest (index.js:423:12) at next (/Users/blemair/Code/DependencyGraphTest/node_modules/connect/lib/proto.js:174:15) at Object.module.exports [as handle] (cpuProfilerMiddleware.js:17:5) at next (/Users/blemair/Code/DependencyGraphTest/node_modules/connect/lib/proto.js:174:15) at Object.module.exports [as Closes https://github.com/facebook/react-native/pull/8117 Differential Revision: D3445582 fbshipit-source-id: cf5af8bbba293f39773f32814a3b388b7ff67bf7 --- packager/README.md | 4 +--- packager/react-packager/src/Bundler/index.js | 4 ---- packager/react-packager/src/Resolver/index.js | 4 ---- packager/react-packager/src/Server/index.js | 5 ----- 4 files changed, 1 insertion(+), 16 deletions(-) diff --git a/packager/README.md b/packager/README.md index 9a89cd9da3b..c8e314cc984 100644 --- a/packager/README.md +++ b/packager/README.md @@ -72,12 +72,10 @@ Here are the current options the packager accepts: ### /debug -This is a page used for debugging, it has links to two pages: +This is a page used for debugging, it offers a link to a single page : * Cached Packages: which shows you the packages that's been already generated and cached -* Dependency Graph: is the in-memory graph of all the modules and - their dependencies ## Programmatic API diff --git a/packager/react-packager/src/Bundler/index.js b/packager/react-packager/src/Bundler/index.js index 8b411be9fdd..d2053fa1bcd 100644 --- a/packager/react-packager/src/Bundler/index.js +++ b/packager/react-packager/src/Bundler/index.js @@ -566,10 +566,6 @@ class Bundler { }); } - getGraphDebugInfo() { - return this._resolver.getDebugInfo(); - } - _generateAssetModule_DEPRECATED(bundle, module, getModuleId) { return Promise.all([ sizeOf(module.path), diff --git a/packager/react-packager/src/Resolver/index.js b/packager/react-packager/src/Resolver/index.js index 865cd683b5d..c8faa60a5b3 100644 --- a/packager/react-packager/src/Resolver/index.js +++ b/packager/react-packager/src/Resolver/index.js @@ -265,10 +265,6 @@ class Resolver { minifyModule({path, code, map}) { return this._minifyCode(path, code, map); } - - getDebugInfo() { - return this._depGraph.getDebugInfo(); - } } function defineModuleCode(moduleName, code, verboseName = '', dev = true) { diff --git a/packager/react-packager/src/Server/index.js b/packager/react-packager/src/Server/index.js index f040f771445..ef35844fd97 100644 --- a/packager/react-packager/src/Server/index.js +++ b/packager/react-packager/src/Server/index.js @@ -348,7 +348,6 @@ class Server { const parts = pathname.split('/').filter(Boolean); if (parts.length === 1) { ret += '
Cached Bundles
'; - ret += '
Dependency Graph
'; res.end(ret); } else if (parts[1] === 'bundles') { ret += '

Cached Bundles

'; @@ -365,10 +364,6 @@ class Server { console.log(e.stack); // eslint-disable-line no-console-disallow } ); - } else if (parts[1] === 'graph'){ - ret += '

Dependency Graph

'; - ret += this._bundler.getGraphDebugInfo(); - res.end(ret); } else { res.writeHead('404'); res.end('Invalid debug request');