Unexpected error message after deployed

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

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

thanks

Hi @virtuosity, sorry for the delayed reply.

Add Cors middleware to your node server.

Add this line to your code:

app.use(cors())

Don’t forget to import the dependency as well.

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

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

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.

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.

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.

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.

1 Like

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

And thank you for the kind words. :slightly_smiling_face:

2 Likes