diff --git a/src/components/Onboarding/database-not-writeable.tsx b/src/components/Onboarding/database-not-writeable.tsx index ac1e92527..b2d313a9d 100644 --- a/src/components/Onboarding/database-not-writeable.tsx +++ b/src/components/Onboarding/database-not-writeable.tsx @@ -1,7 +1,13 @@ import { Center, Code, List, Stack, Text, Title } from '@mantine/core'; import Head from 'next/head'; -export const DatabaseNotWriteable = ({ error, errorMessage }: { error: any | unknown, errorMessage: string | undefined }) => { +export const DatabaseNotWriteable = ({ + stringifiedError, + errorMessage, +}: { + stringifiedError: string | undefined; + errorMessage: string | undefined; +}) => { return ( <> @@ -30,11 +36,9 @@ export const DatabaseNotWriteable = ({ error, errorMessage }: { error: any | unk - {error && JSON.stringify(error)} + {stringifiedError} - {errorMessage && ( - {errorMessage} - )} + {errorMessage && {errorMessage}} diff --git a/src/pages/onboard.tsx b/src/pages/onboard.tsx index ab7b4b55d..bad0f1f23 100644 --- a/src/pages/onboard.tsx +++ b/src/pages/onboard.tsx @@ -21,8 +21,8 @@ const exec = util.promisify(require('child_process').exec); export default function OnboardPage({ configSchemaVersions, databaseNotWriteable, - error, - errorMessage + stringifiedError, + errorMessage, }: InferGetServerSidePropsType) { const { fn, colors, colorScheme } = useMantineTheme(); const background = colorScheme === 'dark' ? 'dark.6' : 'gray.1'; @@ -49,7 +49,7 @@ export default function OnboardPage({ {databaseNotWriteable == true ? ( - + ) : ( <> {onboardingSteps ? ( @@ -117,7 +117,8 @@ export const getServerSideProps: GetServerSideProps = async (ctx) => { ...translations, configSchemaVersions: configSchemaVersions, databaseNotWriteable: true, - error: error, + errorMessage: 'Database is not writeable', + stringifiedError: JSON.stringify(error), }, }; } @@ -128,13 +129,18 @@ export const getServerSideProps: GetServerSideProps = async (ctx) => { const { stdout, stderr } = await exec("mount | grep '/data'"); if (stderr.split('\n').length > 1 || stdout.split('\n').length <= 1) { - Consola.error(`Database at '${rawDatabaseUrl}' has not been mounted: ${stdout.replace('\n', '\\n')} ${stderr.replace('\n', '\\n')}`); + Consola.error( + `Database at '${rawDatabaseUrl}' has not been mounted: ${stdout.replace( + '\n', + '\\n' + )} ${stderr.replace('\n', '\\n')}` + ); return { props: { ...translations, configSchemaVersions: configSchemaVersions, databaseNotWriteable: true, - error: `Database at '${rawDatabaseUrl}' is not mounted:\n${stdout}`, + errorMessage: `Database at '${rawDatabaseUrl}' is not mounted:\n${stdout}`, }, }; } @@ -146,8 +152,8 @@ export const getServerSideProps: GetServerSideProps = async (ctx) => { ...translations, configSchemaVersions: configSchemaVersions, databaseNotWriteable: true, - error: error, - errorMessage: errorMessage + stringifiedError: JSON.stringify(error), + errorMessage: errorMessage, }, }; } @@ -160,7 +166,7 @@ export const getServerSideProps: GetServerSideProps = async (ctx) => { props: { ...translations, configSchemaVersions: configSchemaVersions, - databaseNotWriteable: false + databaseNotWriteable: false, }, }; };