Cannot read properties of undefined (reading 'run')
Environment
Node Version: v18.14.0 Nuxt Version: 3.14.1592
Reproduction
.
Describe the bug
In the Sentry report:Cannot read properties of undefined (reading 'run')
Additional context
No response
Logs
Sorry, please provide a minimal reproduction so that we can debug.
Sorry, please provide a minimal reproduction so that we can debug.
I cannot provide it as it is a random issue that occurs in the production environment. I think this is the issue in line 46 of the screenshot, where 'creatdTask (name)' returns' undefined ', and this problem only randomly appears in Google Chrome browser
We experienced a similar issue on React Native.
console.creatdTask does not exist in this runtime and leads to errors. We had to shim it in order to make our libraries that uses hookable work also on React Native:
/**
* React Native does not polyfill `console.createTask`, which leads to errors in dependencies that rely on it
* (e.g. unjs/hookable).
*/
if (!console.createTask) {
console.createTask = () => ({
run: fn => fn(),
});
}
console.creatdTask does not exist in this runtime and leads to errors
hookable inherently includes compatibility judgment, so theoretically it shouldn't be because of this. https://github.com/unjs/hookable/blob/a45a54c3ffd2dfcfa4dd053030547c78aca7460d/src/utils.ts#L64-L65