# Unexpected error message after deployed

**URL:** <https://forum.codewithmosh.com/t/unexpected-error-message-after-deployed/10032>\
**Category:** React\
**Created:** [January 18, 2022, 11:25am UTC](https://forum.codewithmosh.com/t/unexpected-error-message-after-deployed/10032 "2022-01-18T11:25:18Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![Thiru13](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.codewithmosh.com/thiru13/32/3092_2.png) [@Thiru13](https://forum.codewithmosh.com/u/Thiru13)\
**Post date:** [January 18, 2022, 11:25am UTC](https://forum.codewithmosh.com/t/unexpected-error-message-after-deployed/10032/1 "2022-01-18T11:25:18Z")

</div>

I had an issue with deploying the front end(Vidly application), actually I did managed to deploy the front end, but I keep getting toast notification with error message unexpected error, even while I was trying to login, I keep getting the same error message. I wanted to proceed with the course because I’m currently at the last section of the course (Advanced Topics). However, Im still keen to hear from you guys if you are facing this similar issue like me and able to solve this.  
 ![image](https://us1.discourse-cdn.com/flex020/uploads/codewithmosh/original/2X/3/392b86094f89e0d734e9f1dd75da972b050108ad.png)

---

<div class="post-metadata">

**Author:** ![virtuosity](https://avatars.discourse-cdn.com/v4/letter/v/35a633/32.png) [@virtuosity](https://forum.codewithmosh.com/u/virtuosity)\
**Post date:** [January 20, 2022, 10:01pm UTC](https://forum.codewithmosh.com/t/unexpected-error-message-after-deployed/10032/2 "2022-01-20T22:01:48Z")

</div>

Hi  
,  
In your ‘movieService.js’ file , can you display here what your ‘movieUrl’ function looks like.

thanks

---

<div class="post-metadata">

**Author:** ![Thiru13](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.codewithmosh.com/thiru13/32/3092_2.png) [@Thiru13](https://forum.codewithmosh.com/u/Thiru13)\
**Post date:** [January 25, 2022, 2:24pm UTC](https://forum.codewithmosh.com/t/unexpected-error-message-after-deployed/10032/3 "2022-01-25T14:24:30Z")

</div>

![image](https://us1.discourse-cdn.com/flex020/uploads/codewithmosh/original/2X/2/21c9b458abc074c80871ff0b43b6ba580b0a4232.png)

Hi @virtuosity, sorry for the delayed reply.

---

<div class="post-metadata">

**Author:** ![sufian.babri](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.codewithmosh.com/sufian.babri/32/1028_2.png) [@sufian.babri](https://forum.codewithmosh.com/u/sufian.babri)\
**Post date:** [January 26, 2022, 7:38am UTC](https://forum.codewithmosh.com/t/unexpected-error-message-after-deployed/10032/4 "2022-01-26T07:38:08Z")

</div>

Add [Cors](https://www.npmjs.com/package/cors) middleware to your node server.

Add this line to your code:

`app.use(cors())`

Don’t forget to import the dependency as well.

---

<div class="post-metadata">

**Author:** ![Thiru13](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.codewithmosh.com/thiru13/32/3092_2.png) [@Thiru13](https://forum.codewithmosh.com/u/Thiru13)\
**Post date:** [February 8, 2022, 5:43am UTC](https://forum.codewithmosh.com/t/unexpected-error-message-after-deployed/10032/5 "2022-02-08T05:43:29Z")

</div>

Hello brother, it should be added inside index.js file?

 ![image](https://us1.discourse-cdn.com/flex020/uploads/codewithmosh/original/2X/b/b6c80d490fcaf47db8066bf6ec75edf6096af6b2.png)

---

<div class="post-metadata">

**Author:** ![sufian.babri](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.codewithmosh.com/sufian.babri/32/1028_2.png) [@sufian.babri](https://forum.codewithmosh.com/u/sufian.babri)\
**Post date:** [February 8, 2022, 7:50am UTC](https://forum.codewithmosh.com/t/unexpected-error-message-after-deployed/10032/6 "2022-02-08T07:50:13Z")

</div>

Yes it looks okay. Does it work or do you see some error?

---

<div class="post-metadata">

**Author:** ![Thiru13](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.codewithmosh.com/thiru13/32/3092_2.png) [@Thiru13](https://forum.codewithmosh.com/u/Thiru13)\
**Post date:** [February 8, 2022, 8:49am UTC](https://forum.codewithmosh.com/t/unexpected-error-message-after-deployed/10032/7 "2022-02-08T08:49:17Z")

</div>

Hello brother, thank you for replying. The problem still persists, just when I deploy the app in localhost, the toast error notification keeps popping on the top right corner.

 ![image](https://us1.discourse-cdn.com/flex020/uploads/codewithmosh/original/2X/f/f432ab8a4d4f92c0766efd6cd278eba7ba36609f.png)

---

<div class="post-metadata">

**Author:** ![sufian.babri](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.codewithmosh.com/sufian.babri/32/1028_2.png) [@sufian.babri](https://forum.codewithmosh.com/u/sufian.babri)\
**Post date:** [February 8, 2022, 9:37am UTC](https://forum.codewithmosh.com/t/unexpected-error-message-after-deployed/10032/8 "2022-02-08T09:37:13Z")

</div>

Does it happen when you deploy it to heroku or does it happen when running it on your local machine?

Also please copy paste what you see in the console.

---

<div class="post-metadata">

**Author:** ![Thiru13](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.codewithmosh.com/thiru13/32/3092_2.png) [@Thiru13](https://forum.codewithmosh.com/u/Thiru13)\
**Post date:** [March 1, 2022, 8:30am UTC](https://forum.codewithmosh.com/t/unexpected-error-message-after-deployed/10032/9 "2022-03-01T08:30:49Z")

</div>

Hello brother, sorry for the long delayed reply, I actually managed to solve my problem just awhile ago, I added these few lines inside index.js at the backend folder(vidly-api-node). This is the link that helped me to solve this error.

> <https://stackoverflow.com/questions/57009371/access-to-xmlhttprequest-at-from-origin-localhost3000-has-been-blocked/65867020#65867020>

 ![image](https://us1.discourse-cdn.com/flex020/uploads/codewithmosh/original/2X/7/7959de25caf01342c5f1d7ce177429d173ba681f.png)

 ![image](https://us1.discourse-cdn.com/flex020/uploads/codewithmosh/original/2X/a/afba6578b061299d62df77ce8004dbb106ea968b.png)

I just wanted say to thank you for replying, I noticed your replies in many forums and I really appreciate your effort to help others. Keep up the good work brother sufian.

---

<div class="post-metadata">

**Author:** ![sufian.babri](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.codewithmosh.com/sufian.babri/32/1028_2.png) [@sufian.babri](https://forum.codewithmosh.com/u/sufian.babri)\
**Post date:** [March 1, 2022, 11:18am UTC](https://forum.codewithmosh.com/t/unexpected-error-message-after-deployed/10032/10 "2022-03-01T11:18:12Z")

</div>

You’re welcome, brother. I’m glad you were able to solve the issue.

And thank you for the kind words. 🙂
