[SOLVED] Is there anyone who experienced this?

Unhandled Runtime Error

ReactMoralisError: Provide a “appId” provided to image

it looks like serverUrl and appId were not set

I did but still doesn’t work :zipper_mouth_face: :disappointed_relieved:

import { MoralisProvider } from “react-moralis”;
import “…/styles/globals.css”;
function MyApp({ Component, pageProps }) {
return (
<MoralisProvider
appId={process.env.NEXT_PUBLIC_APP_ID}
serverUrl={process.env.NEXT_PUBLIC_SERVER_URL}

  <Component {...pageProps} />
</MoralisProvider>

);
}
export default MyApp;

try to hardcode them instead of using process.env.NEXT_PUBLIC_APP_ID

I couldn’t use process.env directly inside of MoralisProvider, and had to do it this way.

const appId = process.env.NEXT_PUBLIC_REACT_APP_MORALIS_APP_ID;
const serverUrl = process.env.NEXT_PUBLIC_REACT_APP_MORALIS_SERVER_ID;

<MoralisProvider
    appId={appId}
    serverUrl={serverUrl}
    >

It worked. Thank you so much

as of June 3rd the previous solution doesn’t work as I tried it still giving that same errorScreen Shot 2022-06-03 at 6.44.44 PM

Can we see your code? Does hardcoding the appId work?

this is what I had originally Screen Shot 2022-06-03 at 8.27.26 PM

then this is what I have now after reading what others wrote Screen Shot 2022-06-03 at 8.25.58 PM

for some reason nothing is working and I think it has to do with .env because when i put the the secret code in it work perfectly fine. Oh and im also running on latest version moralis

Did you change your .env file to reflect the addition of REACT_APP_ in the second example?

Do you get a valid value if you log appId directly below and reload your app?

const AppId = ...
const serverUrl = ...

console.log("App ID", appId);

Thank you so much @alex for the help and to open my eyes. Everything works now. :clap: :clap: :raised_hands:

Solution