# Error: You need to call Parse.initialize before using Parse

**URL:** <https://community.parseplatform.org/t/error-you-need-to-call-parse-initialize-before-using-parse/773>\
**Category:** JavaScript SDK\
**Created:** [September 1, 2020, 11:01am UTC](https://community.parseplatform.org/t/error-you-need-to-call-parse-initialize-before-using-parse/773 "2020-09-01T11:01:38Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![hrahimi270](https://community.parseplatform.org/user_avatar/community.parseplatform.org/hrahimi270/32/142_2.png) [@hrahimi270](https://community.parseplatform.org/u/hrahimi270)\
**Post date:** [September 1, 2020, 11:01am UTC](https://community.parseplatform.org/t/error-you-need-to-call-parse-initialize-before-using-parse/773/1 "2020-09-01T11:01:38Z")

</div>

Hi members!  
I was working on a project built with Parse.  
Now after a while, I come to do some changes.  
But, I have an error for running Parse. It says I need to initialize it first.  
I initialize it before use it. Like this:

```auto
import Parse from "parse";

Parse.initialize(process.env.APP_ID, process.env.MASTER_KEY);
Parse.serverURL = process.env.SERVER_URL;
Parse.masterKey = process.env.MASTER_KEY;

export default Parse;

```

And I will use the exported Parse from this file and use it in my app. I’m a little confused because it was working fine a while ago (:

---

<div class="post-metadata">

**Author:** ![davimacedo](https://community.parseplatform.org/user_avatar/community.parseplatform.org/davimacedo/32/316_2.png) [@davimacedo](https://community.parseplatform.org/u/davimacedo)\
**Post date:** [September 1, 2020, 10:57pm UTC](https://community.parseplatform.org/t/error-you-need-to-call-parse-initialize-before-using-parse/773/2 "2020-09-01T22:57:24Z")

</div>

What is the line of code that is throwing that error message?

---

<div class="post-metadata">

**Author:** ![hrahimi270](https://community.parseplatform.org/user_avatar/community.parseplatform.org/hrahimi270/32/142_2.png) [@hrahimi270](https://community.parseplatform.org/u/hrahimi270)\
**Post date:** [September 2, 2020, 10:23am UTC](https://community.parseplatform.org/t/error-you-need-to-call-parse-initialize-before-using-parse/773/3 "2020-09-02T10:23:33Z")

</div>

Almost every where I imported Parse from the initial file. Like this picture:

 ![Screen Shot 2020-09-02 at 2.49.32 PM](https://parse-community-forum-uploads.s3.dualstack.us-east-1.amazonaws.com/original/1X/630d37803c722e38108f8e413faa99f0fe65f384.png)

---

<div class="post-metadata">

**Author:** ![davimacedo](https://community.parseplatform.org/user_avatar/community.parseplatform.org/davimacedo/32/316_2.png) [@davimacedo](https://community.parseplatform.org/u/davimacedo)\
**Post date:** [September 2, 2020, 9:38pm UTC](https://community.parseplatform.org/t/error-you-need-to-call-parse-initialize-before-using-parse/773/4 "2020-09-02T21:38:18Z")

</div>

You need to make sure that your initialization code runs before the other files.

---

<div class="post-metadata">

**Author:** ![hrahimi270](https://community.parseplatform.org/user_avatar/community.parseplatform.org/hrahimi270/32/142_2.png) [@hrahimi270](https://community.parseplatform.org/u/hrahimi270)\
**Post date:** [September 3, 2020, 7:14am UTC](https://community.parseplatform.org/t/error-you-need-to-call-parse-initialize-before-using-parse/773/5 "2020-09-03T07:14:16Z")

</div>

So, how can I make sure of that? Because it was fine earlier.

---

<div class="post-metadata">

**Author:** ![hrahimi270](https://community.parseplatform.org/user_avatar/community.parseplatform.org/hrahimi270/32/142_2.png) [@hrahimi270](https://community.parseplatform.org/u/hrahimi270)\
**Post date:** [September 3, 2020, 7:26am UTC](https://community.parseplatform.org/t/error-you-need-to-call-parse-initialize-before-using-parse/773/6 "2020-09-03T07:26:00Z")

</div>

I tried to make it a function that exports an initialized Parse when calling it. Not sure about this approach, but this is the code:

```auto
function initialize() {
	Parse.initialize(process.env.APP_ID, process.env.MASTER_KEY);
	Parse.serverURL = serverUrl;
	Parse.masterKey = process.env.MASTER_KEY;

	return Parse;
}

export default initialize;

```

and in other files to something like this:

```auto
import Parse from "lib/parse";

...

Parse().Config.get()

```

But the same result again.

---

<div class="post-metadata">

**Author:** ![davimacedo](https://community.parseplatform.org/user_avatar/community.parseplatform.org/davimacedo/32/316_2.png) [@davimacedo](https://community.parseplatform.org/u/davimacedo)\
**Post date:** [September 4, 2020, 7:52am UTC](https://community.parseplatform.org/t/error-you-need-to-call-parse-initialize-before-using-parse/773/7 "2020-09-04T07:52:39Z")

</div>

It really depends on the framework you are using, but you need to make sure that initialize() function is called since the app is loaded and before any other call to Parse.

---

<div class="post-metadata">

**Author:** ![hrahimi270](https://community.parseplatform.org/user_avatar/community.parseplatform.org/hrahimi270/32/142_2.png) [@hrahimi270](https://community.parseplatform.org/u/hrahimi270)\
**Post date:** [September 4, 2020, 7:56am UTC](https://community.parseplatform.org/t/error-you-need-to-call-parse-initialize-before-using-parse/773/8 "2020-09-04T07:56:49Z")

</div>

I’m using Next.js as my framework. And I’m using the non-nodejs version of Parse. Do you think calling it in `_app.js` would be enough?

---

<div class="post-metadata">

**Author:** ![davimacedo](https://community.parseplatform.org/user_avatar/community.parseplatform.org/davimacedo/32/316_2.png) [@davimacedo](https://community.parseplatform.org/u/davimacedo)\
**Post date:** [September 4, 2020, 6:39pm UTC](https://community.parseplatform.org/t/error-you-need-to-call-parse-initialize-before-using-parse/773/9 "2020-09-04T18:39:29Z")

</div>

Calling in \_app.js should fix the issue. Also it is importante to check whether the code is running in browser or node and load the appropriate sdk.
