How to deploy node.j app using prismic on heroku

So i've trying to deploy this app using prismic on heroku but idk y i keep getting R10 error code of heroku

this is the link of the issue i posted on their stackoverflow community

R10 error code

ik that there is something do with env thing from which i am not so aware of and also i believe that you guys can help me with this thing :slight_smile: and also thanks for creating such a nice tool/technology which saves us a lot of time and also helps our clients too. stay safe stay healthy, take care of your family.

Hello @ojasshukla211

Thanks for your nice words and feedback.

I have checked your conversation on stack overflow. So did you commit and push your latest change when you updated your code on the local?
Also, Did you follow this guideline Why is my Node.js app crashing with an R10 error? - Heroku Help.

If it still doesn't solve your issue, I'd need your project code (Github repo or Zip file).

Thanks,
Priyanka

I able to solve the error R10 but idk why maybe i dont have luck one error solve second comes second solves third comes :rofl: so now i am getting this error and for R10 error I forgot to save the changes i made to github thats y i not able to see any changes on the heroku app it would have worked with heroku right as i am using only prismic, express, webpack and all as a techstack.

so the error rn i am trying to resolve is this one:

UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error
originated either by throwing inside of an async function without a catch
block, or by rejecting a promise which was not handled with .catch(). To
terminate the node process on unhandled promise rejection, use the CLI flag `--
unhandled-rejections=strict`
(see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 2)

@ojasshukla211 You are getting this issue because you haven't put your await calls of async function in try/catch block to avoid UnhandledPromiseRejection Error. You can see example in app.js of one of the example projects: nodejs-website/app.js at master ยท prismicio/nodejs-website ยท GitHub

hi thankyou for helping me after looking at my code i believe that i not have such type of try/catch block and.... why don't you just download the repo :smile: repo-link and help me with that.

also sending you the .env file in private :slight_smile:

Hello @ojasshukla211

Please follow the example project I have shared with you. You need to put try/catch block in every route.
For example:

app.get('/', async (req, res, next) => {
  const api = await initApi(req);
  const defaults = await handleRequest(api)
    .then((defaults) => {
      if (defaults) {
        res.render('pages/home', {
          ...defaults,
        });
      } else {
        res.status(404).render('404');
      }
    })
    .catch((error) => {
      next(`error when retriving page ${error.message}`);
    });
});

Thanks,
Priyanka

not working have did just exactly what you showed in example but not worked :c
link of that app heroku app

can you tell me your name on github so that i can give you the access of private repo which is just same like the public one but i saved the changes to private one just to try so

have you tried doing that at your end coz i thought the example you give me should have worked as i gave everything lol :laughing:

@ojasshukla211 You need to put try/catch block in every route. You can follow any nodejs example projects that are deployed on Heroku. You can send me a Zip file of your project. I will look again.

hey for the note i've sent you the zip file with .env that time only if you not able to get that please contact me so i can give you again

Hello @ojasshukla211

Is your project working locally without any error?

Can you please follow one of our update node js example projects: GitHub - prismicio/nodejs-blog

You can create a utils/asyn-handler.js file and apply error handling accordingly.

Thanks,
Priyanka

Is your project working locally without any error?

yes got no errors

have you able to deploy and make it work normally with no errors at your end? as i've provided everything which it requires so i hope it should work at your end i guess :grinning:

Hello @ojasshukla211

Sorry, I haven't tried your app to deploy on Heroku. Can you send me all details again to start your app? You can send me a private message.

Thanks,
Priyanka