无法解构 'undefined' 或 'null' 的 属性 `auth`

Cannot destructure property `auth` of 'undefined' or 'null'

我正在尝试从控制器调用用户数据,但出现以下错误无法解构 属性 auth of 'undefined' 或 'null'。

async datosPersona({ auth }) {
    console.log(auth.username)
}

async datosPersona({ auth }) {
}

两个示例中的任何一个都抛出相同的错误

我正在使用 adonisjs

问题出在通话中。你在某处做的相当于

 datosPersona(undefined)