import nookies from 'nookies';
import { firebaseAdmin } from "../firebaseAdmin";
import { TChildren } from "../types/app/app.types";
interface Props {
children: TChildren;
}
export default function ProtectedRoute(props: Props): JSX.Element {
return <>
{props.children}
</>
}
export const getServerSideProps = async (ctx: GetServerSidePropsContext) => {
const cookies = nookies.get(ctx);
const data = await firebaseAdmin.auth().verifyIdToken(cookies.token);
console.log(data);
return {
props: { message: `Your email is .` },
};
};
await firebaseAdmin.auth().verifyIdToken throws error module not found: can't resolve fs, How to fix this error?
I know that we have different types of runtime environments like edge, browser nodeJs, but based of the docs and examples getServerSide Props runs on nodeJs environment which means that I shouldn't get this kind of error...
Is the 'fs' module available in the environment?
npm i fs-extra
Then using commonjs:
const fs = require('fs-extra')
OR using latest es6 module system:
import fs from 'fs-extra'
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.