Skip to content

Parse.initialize error when using env variable #133

@RaflyLesmana3003

Description

@RaflyLesmana3003

hello👋🏻, I got error Error: You need to call Parse.initialize before using Parse. when i am using environment variable, but when I try to use NEXT_PUBLIC_, i works fine.

i have security concern when using NEXT_PUBLIC_, is there anything i should try?

this is my next js _app.js file

// Client-side cache, shared for the whole session of the user in the browser.
const clientSideEmotionCache = createEmotionCache();

interface MyAppProps extends AppProps {
  emotionCache?: EmotionCache;
}

const layouts: any = {
  Blank: BlankLayout,
};

initializeParse(
  process.env.PARSE_SERVER_URL ?? "",
  process.env.PARSE_APP_ID ?? "",
  process.env.PARSE_JS_KEY ?? ""
);

const MyApp = (props: MyAppProps) => {
  const {
    Component,
    emotionCache = clientSideEmotionCache,
    pageProps,
  }: any = props;
  const theme = ThemeSettings();
  const Layout = layouts[Component.layout] || FullLayout;

  return (
    <CacheProvider value={emotionCache}>
      <Head>
        <meta name="viewport" content="initial-scale=1, width=device-width" />
        <title>Modernize NextJs Admin template</title>
      </Head>
      <ThemeProvider theme={theme}>
          <CssBaseline />
          <Layout>
            <Component {...pageProps} />
          </Layout>
      </ThemeProvider>
    </CacheProvider>
  );
};

export default (props: MyAppProps) => (
  <Provider store={Store}>
    <MyApp {...props} />
  </Provider>
);

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions