https://kotlinlang.org logo
Title
n

Nazar Pohonchuk

05/15/2023, 6:47 PM
Hi, I downloaded RealWorld example application. I want to use this example to learn how to deploy KVision full-stack project on Heroku. (Or you may suggest any other cloud platform). I have tried this tutorial Ktor Heroku. Heroku says "Build succeeded" ", but when I open the link I get "Application error" (Screenshot below). Logs are too big for this message, so I use pastebin Logs . I think that I need to change Procfile somehow, but I don't understand exactly what I need to do. Could you help me, please?
a

ashmelev

05/15/2023, 7:36 PM
@Nazar Pohonchuk I think the underlying cause is your JDBC URL. The error:
IllegalArgumentException: URL ?sslMode=REQUIRE does not start with the r2dbc scheme
indicates you probably need to change the URL string in the database connection config
n

Nazar Pohonchuk

05/15/2023, 7:44 PM
@ashmelev I downloaded the project from GitHub and I didn't change Procfile.
web: java -Dserver.port=$PORT -Dspring.r2dbc.url=`echo $JDBC_DATABASE_URL | sed -e "s/jdbc:/r2dbc:/" | sed -e "s/?.*//"`?sslMode=REQUIRE -Dspring.r2dbc.username=$JDBC_DATABASE_USERNAME -Dspring.r2dbc.password=$JDBC_DATABASE_PASSWORD -jar build/libs/kvision-realworld-example-app-fullstack-1.0.0-SNAPSHOT.jar
So what URL should I paste? I think It is a really dumb question, but I am a newbie. So could you please explain how would I get that URL?
Also, in README.md the Demo link (deployed application on Heroku) doesn't work. And README.md says that the app uses PostgreSQL when deployed to Heroku, so I need to get the link to PostgreSQL database? May use h2database when deployed to Heroku?
a

ashmelev

05/15/2023, 8:01 PM
Now you are beyond my knowledge base - I do not use Heroku. I can say that, yes, you will need Postgress. I doubt it'll be easy for a newbie [🙂] to substitute H2. That said, in
Profile
you will see
sslMode=REQUIRE
... try to replace that with either
sslMode=false
or
sslMode=disable
If the issue is the SSL connectivity (and associated keystore, etc) the disabling SSL may help
r

Robert Jaros

05/15/2023, 8:07 PM
It seems Heroku doesn't pass JDBC_DATABASE_URL env variable to your app at all.
Have you activated database module?
I don't remember how it's named and I can't login to my heroku account anymore to check.
When you add database module Heroku will pass
jdbc:
url and this procfile will convert it to start with
r2dbc:
prefix.
n

Nazar Pohonchuk

05/16/2023, 9:39 AM
@Robert Jaros I tried this command
heroku pg:credentials:url DATABASE
and got "webk-fullstack has no database" So I ran this command
heroku addons:create heroku-postgresql
and everything works now. Thank you very much for your help!