-
Notifications
You must be signed in to change notification settings - Fork 21
Open
Labels
size: sPull request size is small.Pull request size is small.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.Error or flaw in code with unintended results or allowing sub-optimal usage patterns.
Description
Hi! 👋
Firstly, thanks for your work on this project! 🙂
Today I used patch-package to patch google-logging-utils@0.0.2 for the project I'm working on.
===
Ran into a bug that prevents from deploying on Cloudflare Workers due to getColorDepth being improperly polyfilled. Polyfill should probably be updated but this seems like something that can silently fail as its only for colors.
I ran into this when trying to use gmail API and it looks like others have also ran into this.
googleapis/js-genai#324
https://www.answeroverflow.com/m/1355156041402421248
Not sure if there's a better way to patch this but here is the diff that solved my problem:
diff --git a/node_modules/google-logging-utils/build/src/colours.js b/node_modules/google-logging-utils/build/src/colours.js
index 5132d72..9aed37b 100644
--- a/node_modules/google-logging-utils/build/src/colours.js
+++ b/node_modules/google-logging-utils/build/src/colours.js
@@ -28,10 +28,14 @@ class Colours {
* @returns true if the stream should have colourization enabled
*/
static isEnabled(stream) {
- return (stream.isTTY &&
- (typeof stream.getColorDepth === 'function'
- ? stream.getColorDepth() > 2
- : true));
+ try {
+ return (stream.isTTY &&
+ (typeof stream.getColorDepth === 'function'
+ ? stream.getColorDepth() > 2
+ : true));
+ } catch (error) {
+ return false;
+ }
}
static refresh() {
Colours.enabled = Colours.isEnabled(process.stderr);This issue body was partially generated by patch-package.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
size: sPull request size is small.Pull request size is small.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.Error or flaw in code with unintended results or allowing sub-optimal usage patterns.