Skip to content
This repository was archived by the owner on Apr 3, 2024. It is now read-only.

Commit 7fef0a4

Browse files
fix: Remove the process warning listener (#376)
Node 8.5.0 introduced a change where a warning message discussing the use of async traces would be printed when using the debug agent with the inspector protocol. At that time, a listener was added that listened to that warning and also printed a message stating that the warning does not impact the debug agent. At this point, the underlying issue causing the warning message to appear has been fixed in Node, and, as such, the associated warning listener in the debug agent has be removed.
1 parent 771b655 commit 7fef0a4

File tree

3 files changed

+0
-46
lines changed

3 files changed

+0
-46
lines changed

src/agent/debuglet.ts

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -273,12 +273,6 @@ export class Debuglet extends EventEmitter {
273273
*/
274274
async start(): Promise<void> {
275275
const that = this;
276-
process.on('warning', (warning: NodeJS.ErrnoException) => {
277-
if (warning.code === 'INSPECTOR_ASYNC_STACK_TRACES_NOT_AVAILABLE') {
278-
that.logger.info(utils.messages.ASYNC_TRACES_WARNING);
279-
}
280-
});
281-
282276
const stat = promisify(fs.stat);
283277

284278
try {

src/agent/util/utils.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,6 @@ export const messages = {
2525
INVALID_LINE_NUMBER: 'Invalid snapshot position: ',
2626
COULD_NOT_FIND_OUTPUT_FILE:
2727
'Could not determine the output file associated with the transpiled input file',
28-
ASYNC_TRACES_WARNING:
29-
'The Stackdriver Debugger for Node.js does not require V8 Inspector ' +
30-
'async stack traces. The INSPECTOR_ASYNC_STACK_TRACES_NOT_AVAILABLE ' +
31-
'can be ignored.',
3228
INSPECTOR_NOT_AVAILABLE:
3329
'The V8 Inspector protocol is only available in Node 8+'
3430
};

test/test-debuglet.ts

Lines changed: 0 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -351,42 +351,6 @@ describe('Debuglet', () => {
351351
assert.deepEqual(mergedConfig, compareConfig);
352352
});
353353

354-
it('should elaborate on inspector warning on 32 bit but not on 64 bit',
355-
(done) => {
356-
const projectId = '11020304f2934-a';
357-
const debug =
358-
new Debug({projectId, credentials: fakeCredentials}, packageInfo);
359-
const debuglet = new Debuglet(debug, defaultConfig);
360-
let logText = '';
361-
debuglet.logger.info = (s: string) => {
362-
logText += s;
363-
};
364-
nocks.projectId('project-via-metadata');
365-
const scope = nock(API).post(REGISTER_PATH).reply(200, {
366-
debuggee: {id: DEBUGGEE_ID}
367-
});
368-
369-
debuglet.once('registered', (id: string) => {
370-
assert.equal(id, DEBUGGEE_ID);
371-
// TODO: Handle the case where debuglet.debuggee is undefined
372-
assert.equal((debuglet.debuggee as Debuggee).project, projectId);
373-
const arch = process.arch;
374-
if (semver.satisfies(process.version, '>=8.5.0') &&
375-
semver.satisfies(process.version, '<8.9.0') &&
376-
(arch === 'ia32' || arch === 'x86') &&
377-
process.env.GCLOUD_USE_INSPECTOR) {
378-
assert(logText.includes(utils.messages.ASYNC_TRACES_WARNING));
379-
} else {
380-
assert(!logText.includes(utils.messages.ASYNC_TRACES_WARNING));
381-
}
382-
debuglet.stop();
383-
scope.done();
384-
done();
385-
});
386-
387-
debuglet.start();
388-
});
389-
390354
it('should not start when projectId is not available', (done) => {
391355
const savedGetProjectId = Debuglet.getProjectId;
392356
Debuglet.getProjectId = () => {

0 commit comments

Comments
 (0)