mintlify / writer

✍️ AI powered documentation writer
https://www.mintlify.com/writer
MIT License
2.82k stars 129 forks source link

Cannot destructure property 'requiresAuth' of '(intermediate value)' as it is undefined #103

Open zhuanyan-wang opened 1 year ago

zhuanyan-wang commented 1 year ago

Not sure if this is an isolated case, but recently I found that Mintlify Doc Writer extension no longer works in VS Code due to cannot destructure property 'requiresAuth' of '(intermediate value)' as it is undefined.

Screenshot 2023-02-21 at 12 04 12

Expected Behavior

Current Behavior

Context (Environment)

Possible Solution

Detailed Description

During t.window.withProgress "generating documentation", if an error is caught, it will attempt to extract properties like requiresAuth from e.response.data using destructuring assignment:

const {
  requiresAuth: o,
  requiresUpgrade: n,
  message: s,
  button: i,
} = e?.response?.data;
if (o) return void (0, a.displaySignInView)(s, i);

Cannot destructure property 'requiresAuth' of '(intermediate value)' is thrown if response or data is null or undefined.

It should work after you changed the code to:

const {
  requiresAuth: o,
  requiresUpgrade: n,
  message: s,
  button: i,
} = e?.response?.data || {};
if (o) return void (0, a.displaySignInView)(s, i);
kbader-godaddy commented 1 year ago

I am also running into this bug.

JesseKoldewijn commented 1 year ago

Same here, seemed kind of random as well since I wasn't really running any all to large bits of code through it. Took multiple reinstalls of the extension to get rid of the error and get the extension working again for some reason.

SR-Spoorthi commented 1 year ago

I am facing the same issue. What should I do!?