iTwin / itwinjs-core

Monorepo for iTwin.js Library
https://www.itwinjs.org
MIT License
615 stars 210 forks source link

Attempt to upload an app to heroku #1404

Closed LastLow098 closed 3 years ago

LastLow098 commented 3 years ago

Hello, I am trying to upload this app to heroku, but the app crashes with the H10 error - 2021-05-16T00:09:43.239969+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=glacial-river-93766.herokuapp.com request_id=d8579576-b201-4726-b8ac-9208f0d7cba7 fwd="93.81.221.158" dyno= connect= service= status=503 bytes= protocol=https 2021-05-16T00:09:43.900179+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=glacial-river-93766.herokuapp.com request_id=51a2c4b4-10a4-4375-b42b-7a26c90d8762 fwd="93.81.221.158" dyno= connect= service= status=503 bytes= protocol=https

And I can't figure out how to solve this problem Can you help me with this issue


⚠ Do not edit this section. It is required for imodeljs.github.io ➟ GitHub issue linking

Carl-Hinkle commented 3 years ago

Hi,

It's hard to provide too much assistance without more information about what you're trying to do.

From a quick look at Heroku's documentation, it looks like you'll need to do a little work to deploy a static web site. This guide might be helpful: https://www.geeksforgeeks.org/how-to-deploy-a-basic-static-html-website-to-heroku/.

If you have the option, I suggest using https://www.netlify.com/ instead of heroku for hosting.

LastLow098 commented 3 years ago

Perhaps you have an algorithm for deploying this application on a hosting service? What needs to be changed and where, regardless of which hosting will be used? My task is to be able to access this application from the browser.

calebmshafer commented 3 years ago

@LastLow098 we use, and suggest, create-react-app as the way to build an iTwin.js web application and they provide details on how to deploy a Heroku application, https://create-react-app.dev/docs/deployment#heroku.

If you run into any issues with deploying your viewer using their suggestions please let us know.

LastLow098 commented 3 years ago

Hello, I looked through the site that you recommended to me, but did not find a solution to my problem I deployed the application on heroku, and also recorded the deployment so that the error can be seen, and how it occurs At the launch and build stage, the app crashes. Is there any probability that the problem is in heroku?

https://still-garden-83058.herokuapp.com/ - link to the app https://disk.yandex.ru/d/cPoz3qwJSKHOew - link to the video that shows the app download and also logs

Carl-Hinkle commented 3 years ago

Hi, there are a few things that might be causing the problem that I can see from your video.

  1. The IMJS_AUTH_CLIENT_REDIRECT_URI and IMJS_AUTH_CLIENT_LOGOUT_URI MUST match your deployed urls exactly, including https and any trailing slashes. These values must also exactly match the settings in your OIDC Client. Any changes that you make to the client can take 10-15 minutes to go live.
  2. All of the environment variables MUST be available in the hosting environment. I did not see any steps in your video where you're setting those in Heroku. See https://devcenter.heroku.com/articles/config-vars.
  3. You MUST use your own OIDC client, which you can create and manage here: https://developer.bentley.com/my-apps/ . This is also where you configure the REDIRECT and LOGOUT values mentioned in step 1.
  4. There's a warning in your console that line endings are being changed from LF to CRLF. This MAY cause a problem, but you should verify the environment variables first.
Carl-Hinkle commented 3 years ago

In addition to the points in the last post about setting up your config variables, make sure that you have the correct buildpack configured in your Heroku app as described here: https://www.geeksforgeeks.org/how-to-deploy-react-app-to-heroku/

I confirmed that this does work and I was able to deploy an iTwin app on Heroku.

Carl-Hinkle commented 3 years ago

@LastLow098 I'm going to close this issue since the steps above should solve the problem. Please feel free to reopen or start a new Issue if you need more help. Thanks!

Carl-Hinkle commented 3 years ago

We've just published a guide that explains how to deploy to Heroku and Netlify. If you're still having trouble, please check it out.