question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Bug: [BUG] Crashes on undefined if maskValuesRegEx option specified

See original GitHub issue

Describe the bug Crashes on undefined if maskValuesRegEx option specified

To Reproduce

import { Logger } from 'tslog';

const logger = new Logger({ maskValuesRegEx: [/bearer \S+/] });

logger.info(undefined);

Expected behavior Log empty value same as in case without maskValuesRegEx.

Screenshots

> node dist/cli
./node_modules/tslog/dist/cjs/BaseLogger.js:181
                                    source = source.replace(regEx, this.settings.maskPlaceholder);
                                                    ^

TypeError: Cannot read properties of undefined (reading 'replace')
    at ./node_modules/tslog/dist/cjs/BaseLogger.js:181:53
    at Array.forEach (<anonymous>)
    at ./node_modules/tslog/dist/cjs/BaseLogger.js:180:65
    at Logger._recursiveCloneAndMaskValuesOfKeys (./node_modules/tslog/dist/cjs/BaseLogger.js:184:31)
    at ./node_modules/tslog/dist/cjs/BaseLogger.js:154:25
    at Array.map (<anonymous>)
    at Logger._mask (./node_modules/tslog/dist/cjs/BaseLogger.js:153:22)
    at Logger.log (./node_modules/tslog/dist/cjs/BaseLogger.js:96:24)
    at Logger.info (./node_modules/tslog/dist/cjs/index.js:23:22)
    at Object.<anonymous> (./src/cli.ts:35:8)

Additional context Add any other context about the problem here.

Node.js Version Node.js v18.12.1

OS incl. Version macOS 13.1 (22C65)

Issue Analytics

  • State:closed
  • Created 9 months ago
  • Comments:8 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
terehovcommented, Dec 21, 2022

V4.6.0 is out that fixes this and adds more tests.

1reaction
terehovcommented, Dec 20, 2022

V4.4.6 is out now 👍

Read more comments on GitHub >

github_iconTop Results From Across the Web

Boris Gorbylev ekho - GitHub
Describe the bug Crashes on undefined if maskValuesRegEx option specified To Reproduce import { Logger } from 'tslog'; const logger = new Logger({...
Read more >
React App crashes giving as useState input give an undefined ...
Variables transactionName , setTransactionName , amount and setAmount are not declared. You can either use const or let to declare them.
Read more >
Fix "Aw, Snap!" page crashes and other page loading errors
Fix "Aw, Snap!" page crashes and other page loading errors. If you're getting the "Aw, Snap" error or another error code instead of...
Read more >
Troubleshoot Router Crashes - Cisco
Follow these links to troubleshoot the specific type of crash your router experiences: Abort · Address Error · Bus Error · Cache Error...
Read more >
Diagnosing and resolving bugs in your running app
Inspect your running app to isolate bugs, locate crashes, identify excess system resource usage, visualize memory bugs, and investigate view layout problems ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found