I try to access to the config object from Moralis as documented here:
https://docs.moralis.io/cloud-functions#config
import { Moralis } from 'moralis';
export let HOST;
(async () => {
const config = await Moralis.Config.get({ useMasterKey: false });
HOST = process.env.REACT_APP_HOST || config.get('HOST') || 'http://localhost:3001';
})();
Unfortunately, React returns the following stack trace:
Storage.js:138 Uncaught (in promise) Error: You need to call Parse.initialize before using Parse.
at Object.generatePath (Storage.js:138)
at Object.currentInstallationId (InstallationController.js:31)
at Object.request (RESTController.js:388)
at Object.get (ParseConfig.js:258)
at Function.value (ParseConfig.js:148)
at environment.js:8
at Module.<anonymous> (environment.js:11)
at Module../src/environment.js (environment.js:12)
at __webpack_require__ (bootstrap:856)
at fn (bootstrap:150)
at Module.<anonymous> (CreateGatheringButton.js:55)
at Module../src/components/EditGathering.js (EditGathering.js:63)
at __webpack_require__ (bootstrap:856)
at fn (bootstrap:150)
at Module.<anonymous> (App.css?dde5:82)
at Module../src/App.js (App.js:120)
at __webpack_require__ (bootstrap:856)
at fn (bootstrap:150)
at Module.<anonymous> (environment.js:12)
at Module../src/index.js (index.js:24)
at __webpack_require__ (bootstrap:856)
at fn (bootstrap:150)
at Object.1 (reportWebVitals.js:14)
at __webpack_require__ (bootstrap:856)
at checkDeferredModules (bootstrap:45)
at Array.webpackJsonpCallback [as push] (bootstrap:32)
at main.chunk.js:1
Any idea what I am doing wrong?