Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/reactjs/27.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/typescript/8.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Reactjs 在NextJs中配置Auth0提供程序时出错_Reactjs_Typescript_Next.js_Auth0 - Fatal编程技术网

Reactjs 在NextJs中配置Auth0提供程序时出错

Reactjs 在NextJs中配置Auth0提供程序时出错,reactjs,typescript,next.js,auth0,Reactjs,Typescript,Next.js,Auth0,我正在尝试在我的Nextjs应用程序中使用Auth0。为此,我需要在Auth0Provider中包装我的组件,然后开始使用它。出于某种原因,我得到了这个错误: Error: Objects are not valid as a React child (found: [object Promise]). If you meant to render a collection of children, use an array instead. My_app.tsx import GlobalS

我正在尝试在我的Nextjs应用程序中使用Auth0。为此,我需要在Auth0Provider中包装我的组件,然后开始使用它。出于某种原因,我得到了这个错误:

Error: Objects are not valid as a React child (found: [object Promise]). If you meant to render a collection of children, use an array instead.
My_app.tsx

import GlobalStyles from "../styles/Global";
import { Auth0Provider } from "use-auth0-hooks";

function MyApp({ Component, pageProps }) {
  return (
    <>
      <Auth0Provider
        domain="My domain here"
        redirectUri={window.location.origin}
        clientId="My secret here"
      >
        <Component {...pageProps} />
      </Auth0Provider>

      <GlobalStyles />
    </>
  );
}

export default MyApp;
从“./style/Global”导入全局样式;
从“use-auth0-hooks”导入{Auth0Provider};
函数MyApp({Component,pageProps}){
返回(
);
}
导出默认MyApp;
有人知道发生了什么吗

编辑:删除了异步,它也不工作

Error: Objects are not valid as a React child (found: [object Promise]). If you meant to render a collection of children, use an array instead.
    in Home (at _app.tsx:12)
    in Context.Provider
    in UserProvider
    in Context.Provider
    in Auth0Provider (at _app.tsx:7)
    in Fragment
    in MyApp (at _document.tsx:13)
    in Context.Provider
    in Context.Provider
    in StyleSheetManager
    in Unknown
    in Context.Provider
    in Context.Provider
    in Context.Provider
    in Context.Provider
    in AppContainer

This error happened while generating the page. Any console logs will be displayed in the terminal window.
Source
pages/_document.tsx (11:8) @ Object.ctx.renderPage

   9 | try {
  10 |   ctx.renderPage = () =>
> 11 |     originalRenderPage({
     |    ^
  12 |       enhanceApp: (App) => (props) =>
  13 |         sheet.collectStyles(<App {...props} />),
  14 |     });
Call Stack
Function.getInitialProps
../../pages/_document.tsx (66:33)
错误:对象作为React子对象无效(找到:[object Promise])。如果要呈现子对象集合,请改用数组。
在家里(在应用程序tsx:12)
在Context.Provider中
在用户提供程序中
在Context.Provider中
在Auth0Provider中(位于_app.tsx:7)
零碎
在MyApp中(位于_document.tsx:13)
在Context.Provider中
在Context.Provider中
在样式表管理器中
不为人知
在Context.Provider中
在Context.Provider中
在Context.Provider中
在Context.Provider中
在AppContainer中
生成页面时发生此错误。任何控制台日志都将显示在终端窗口中。
来源
pages/_document.tsx(11:8)@Object.ctx.renderPage
9 |试试看{
10 | ctx.renderPage=()=>
>11 |原始渲染页({
|    ^
12 |增强应用程序:(应用程序)=>(道具)=>
13 |表.集合样式(),
14 |     });
调用堆栈
Function.getInitialProps
../../pages/_document.tsx(66:33)

完整错误日志

您是否正在使用
异步函数MyApp
?我想这里没有
异步