Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

One-click Deploy-to-Heroku broken #2949

Closed
kylebakerio opened this issue Jan 24, 2021 · 35 comments
Closed

One-click Deploy-to-Heroku broken #2949

kylebakerio opened this issue Jan 24, 2021 · 35 comments
Assignees
Labels
bug Something isn't working

Comments

@kylebakerio
Copy link

kylebakerio commented Jan 24, 2021

Describe the bug
I attempted a 1-click install to heroku via the wiki.js website. The site fails to load, however.

To Reproduce
Steps to reproduce the behavior:

  1. Go to https://docs.requarks.io/install/heroku
  2. Click on 'deploy to heroku'
  3. Create a new heroku account
    [...complete setup, etc.]
  4. Upon "successful" deploy, see deployed site, e.g.:
    https://aframe-wiki.herokuapp.com/
    (at this time, shows as seen in image below:)
    aper

Expected behavior
One-click deploy results in a functional site deployed

Screenshots
See above

Host Info (please complete the following information):

  • OS: unsure, whatever the stack heroku uses is / whatever your deploy link creates from the manifest.
  • Wiki.js version: I am unsure, whatever is deployed from the 1-click option--from the link behind the button, I do see "2.x".
  • Database engine: clicking around on the heroku project, it seems to be postgres 12.5.

Additional context
Based on the heroku logs below, it seems to be a problem connecting with the database.
Also, when I attempted to clone down from heroku, I got an empty folder? That's confusing. I assume there's just some other workflow I don't know about, but I'm not exactly sure what to do with that. (To be clear: running git clone https://git.heroku.com/aframe-wiki.git got me an empty folder).

I do see this line in the heroku one click page: "The database endpoint must be provided as DATABASE_URL environment variable to the app (default)."

However, more detail is needed. I'm quite unsure how to proceed.

Btw, the link for "Another option is to clone the wiki-heroku" is broken. It points to https://github.com/Requarks/wiki-heroku/tree/beta. I imagine it should be in sync with the button, and say https://github.com/requarks/wiki-heroku/tree/2.x

2021-01-24T14:34:58.426254+00:00 heroku[web.1]: Starting process with command `node server`
2021-01-24T14:35:00.581616+00:00 app[web.1]: Loading configuration from /wiki/config.yml... OK
2021-01-24T14:35:00.687743+00:00 app[web.1]: 2021-01-24T14:35:00.686Z [MASTER] info: =======================================
2021-01-24T14:35:00.688894+00:00 app[web.1]: 2021-01-24T14:35:00.688Z [MASTER] info: = Wiki.js 2.5.170 =====================
2021-01-24T14:35:00.689035+00:00 app[web.1]: 2021-01-24T14:35:00.688Z [MASTER] info: =======================================
2021-01-24T14:35:00.689185+00:00 app[web.1]: 2021-01-24T14:35:00.689Z [MASTER] info: Initializing...
2021-01-24T14:35:01.392888+00:00 app[web.1]: 2021-01-24T14:35:01.392Z [MASTER] info: Using database driver pg for postgres [ OK ]
2021-01-24T14:35:01.397901+00:00 app[web.1]: 2021-01-24T14:35:01.397Z [MASTER] info: Connecting to database...
2021-01-24T14:35:01.427029+00:00 app[web.1]: 2021-01-24T14:35:01.426Z [MASTER] error: Database Connection Error: 28000 undefined:undefined
2021-01-24T14:35:01.427329+00:00 app[web.1]: 2021-01-24T14:35:01.427Z [MASTER] warn: Will retry in 3 seconds... [Attempt 1 of 10]
2021-01-24T14:35:04.430923+00:00 app[web.1]: 2021-01-24T14:35:04.430Z [MASTER] info: Connecting to database...
2021-01-24T14:35:04.461629+00:00 app[web.1]: 2021-01-24T14:35:04.461Z [MASTER] error: Database Connection Error: 28000 undefined:undefined
2021-01-24T14:35:04.461974+00:00 app[web.1]: 2021-01-24T14:35:04.461Z [MASTER] warn: Will retry in 3 seconds... [Attempt 2 of 10]
2021-01-24T14:35:07.464781+00:00 app[web.1]: 2021-01-24T14:35:07.464Z [MASTER] info: Connecting to database...
2021-01-24T14:35:07.474863+00:00 app[web.1]: 2021-01-24T14:35:07.474Z [MASTER] error: Database Connection Error: 28000 undefined:undefined
2021-01-24T14:35:07.475079+00:00 app[web.1]: 2021-01-24T14:35:07.474Z [MASTER] warn: Will retry in 3 seconds... [Attempt 3 of 10]
2021-01-24T14:35:10.476185+00:00 app[web.1]: 2021-01-24T14:35:10.475Z [MASTER] info: Connecting to database...
2021-01-24T14:35:10.493949+00:00 app[web.1]: 2021-01-24T14:35:10.493Z [MASTER] error: Database Connection Error: 28000 undefined:undefined
2021-01-24T14:35:10.494207+00:00 app[web.1]: 2021-01-24T14:35:10.494Z [MASTER] warn: Will retry in 3 seconds... [Attempt 4 of 10]
2021-01-24T14:35:13.497798+00:00 app[web.1]: 2021-01-24T14:35:13.497Z [MASTER] info: Connecting to database...
2021-01-24T14:35:13.516885+00:00 app[web.1]: 2021-01-24T14:35:13.516Z [MASTER] error: Database Connection Error: 28000 undefined:undefined
2021-01-24T14:35:13.517127+00:00 app[web.1]: 2021-01-24T14:35:13.517Z [MASTER] warn: Will retry in 3 seconds... [Attempt 5 of 10]
2021-01-24T14:35:16.518196+00:00 app[web.1]: 2021-01-24T14:35:16.518Z [MASTER] info: Connecting to database...
2021-01-24T14:35:16.530953+00:00 app[web.1]: 2021-01-24T14:35:16.530Z [MASTER] error: Database Connection Error: 28000 undefined:undefined
2021-01-24T14:35:16.531116+00:00 app[web.1]: 2021-01-24T14:35:16.531Z [MASTER] warn: Will retry in 3 seconds... [Attempt 6 of 10]
2021-01-24T14:35:19.534167+00:00 app[web.1]: 2021-01-24T14:35:19.534Z [MASTER] info: Connecting to database...
2021-01-24T14:35:19.544785+00:00 app[web.1]: 2021-01-24T14:35:19.544Z [MASTER] error: Database Connection Error: 28000 undefined:undefined
2021-01-24T14:35:19.544967+00:00 app[web.1]: 2021-01-24T14:35:19.544Z [MASTER] warn: Will retry in 3 seconds... [Attempt 7 of 10]
2021-01-24T14:35:22.546297+00:00 app[web.1]: 2021-01-24T14:35:22.546Z [MASTER] info: Connecting to database...
2021-01-24T14:35:22.568118+00:00 app[web.1]: 2021-01-24T14:35:22.568Z [MASTER] error: Database Connection Error: 28000 undefined:undefined
2021-01-24T14:35:22.568406+00:00 app[web.1]: 2021-01-24T14:35:22.568Z [MASTER] warn: Will retry in 3 seconds... [Attempt 8 of 10]
2021-01-24T14:35:25.570237+00:00 app[web.1]: 2021-01-24T14:35:25.570Z [MASTER] info: Connecting to database...
2021-01-24T14:35:25.579882+00:00 app[web.1]: 2021-01-24T14:35:25.579Z [MASTER] error: Database Connection Error: 28000 undefined:undefined
2021-01-24T14:35:25.580110+00:00 app[web.1]: 2021-01-24T14:35:25.580Z [MASTER] warn: Will retry in 3 seconds... [Attempt 9 of 10]
2021-01-24T14:35:28.582168+00:00 app[web.1]: 2021-01-24T14:35:28.582Z [MASTER] info: Connecting to database...
2021-01-24T14:35:28.599996+00:00 app[web.1]: 2021-01-24T14:35:28.599Z [MASTER] error: Database Connection Error: 28000 undefined:undefined
2021-01-24T14:35:28.600522+00:00 app[web.1]: 2021-01-24T14:35:28.600Z [MASTER] warn: Will retry in 3 seconds... [Attempt 10 of 10]
2021-01-24T14:35:31.602837+00:00 app[web.1]: 2021-01-24T14:35:31.602Z [MASTER] info: Connecting to database...
2021-01-24T14:35:31.614019+00:00 app[web.1]: 2021-01-24T14:35:31.613Z [MASTER] error: Database Initialization Error: no pg_hba.conf entry for host "3.85.87.175", user "qwxhtrvxbeuwsx", database "d1qi0m3cdni7rl", SSL off
2021-01-24T14:35:31.700844+00:00 heroku[web.1]: Process exited with status 1
2021-01-24T14:35:31.746209+00:00 heroku[web.1]: State changed from starting to crashed
2021-01-24T14:35:32.757209+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=aframe-wiki.herokuapp.com request_id=30031a83-a46d-4c94-9b9d-0024ed72610e fwd="89.246.121.8" dyno= connect= service= status=503 bytes= protocol=https
2021-01-24T14:35:35.102532+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=aframe-wiki.herokuapp.com request_id=200afd13-6b18-42a2-b7ee-444909f9ec00 fwd="89.246.121.8" dyno= connect= service= status=503 bytes= protocol=https
2021-01-24T14:36:06.479985+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=aframe-wiki.herokuapp.com request_id=1c454598-4e42-462f-95ae-6cbf454a56b9 fwd="89.246.121.8" dyno= connect= service= status=503 bytes= protocol=https
2021-01-24T14:36:07.362820+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=aframe-wiki.herokuapp.com request_id=4b089b4f-6c78-4c63-a921-ffda8b878c76 fwd="89.246.121.8" dyno= connect= service= status=503 bytes= protocol=https

Edit:
Just wanted to add that this is the build log from the original build:

=== Fetching app code..
=== Building web (Dockerfile)
Sending build context to Docker daemon  9.216kBStep 1/6 : FROM requarks/wiki:2
2: Pulling from requarks/wiki
cbdbe7a5bc2a: Pulling fs layer
378c9540b231: Pulling fs layer
fd5173d17220: Pulling fs layer
72f138d46980: Pulling fs layer
74382a44e606: Pulling fs layer
4f4fb700ef54: Pulling fs layer
ab5ff9e03eb3: Pulling fs layer
1fea9e8e8c69: Pulling fs layer
9f0cf322f125: Pulling fs layer
2b3bef2c2387: Pulling fs layer
851aa5803f4c: Pulling fs layer
8d5a10bb333d: Pulling fs layer
0490c826c8fe: Pulling fs layer
72f138d46980: Waiting
74382a44e606: Waiting
4f4fb700ef54: Waiting
ab5ff9e03eb3: Waiting
1fea9e8e8c69: Waiting
9f0cf322f125: Waiting
2b3bef2c2387: Waiting
851aa5803f4c: Waiting
8d5a10bb333d: Waiting
0490c826c8fe: Waiting
fd5173d17220: Verifying Checksum
fd5173d17220: Download complete
cbdbe7a5bc2a: Verifying Checksum
cbdbe7a5bc2a: Download complete
72f138d46980: Verifying Checksum
72f138d46980: Download complete
378c9540b231: Verifying Checksum
378c9540b231: Download complete
74382a44e606: Verifying Checksum
74382a44e606: Download complete
4f4fb700ef54: Verifying Checksum
4f4fb700ef54: Download complete
cbdbe7a5bc2a: Pull complete
9f0cf322f125: Verifying Checksum
9f0cf322f125: Download complete
ab5ff9e03eb3: Verifying Checksum
ab5ff9e03eb3: Download complete
1fea9e8e8c69: Verifying Checksum
1fea9e8e8c69: Download complete
8d5a10bb333d: Verifying Checksum
8d5a10bb333d: Download complete
2b3bef2c2387: Verifying Checksum
2b3bef2c2387: Download complete
851aa5803f4c: Verifying Checksum
851aa5803f4c: Download complete
0490c826c8fe: Verifying Checksum
0490c826c8fe: Download complete
378c9540b231: Pull complete
fd5173d17220: Pull complete
72f138d46980: Pull complete
74382a44e606: Pull complete
4f4fb700ef54: Pull complete
ab5ff9e03eb3: Pull complete
1fea9e8e8c69: Pull complete
9f0cf322f125: Pull complete
2b3bef2c2387: Pull complete
851aa5803f4c: Pull complete
8d5a10bb333d: Pull complete
0490c826c8fe: Pull complete
Digest: sha256:9607e23fa276a360785e833158140a55e3712e55ae9a339f43bcbd88e0d95323
Status: Downloaded newer image for requarks/wiki:2
 ---> f439bc73d690
Step 2/6 : WORKDIR /wiki
 ---> Running in 5f429d1bb748
Removing intermediate container 5f429d1bb748
 ---> 3305100c7dd8
Step 3/6 : ENV DB_TYPE postgres
 ---> Running in f226ba6cc09b
Removing intermediate container f226ba6cc09b
 ---> e776d362f448
Step 4/6 : ENV DB_SSL 1
 ---> Running in 8d9c9df384ce
Removing intermediate container 8d9c9df384ce
 ---> bf0ac3342efb
Step 5/6 : ENV HEROKU 1
 ---> Running in 9c65d6f57a31
Removing intermediate container 9c65d6f57a31
 ---> 19c56621328a
Step 6/6 : CMD ["node", "server"]
 ---> Running in 747dc181c8bc
Removing intermediate container 747dc181c8bc
 ---> 84a6c0658e6a
Successfully built 84a6c0658e6a
Successfully tagged c5ffba5f4914d4701522b541b56cb1d5bd1bb467:latest
=== Pushing web (Dockerfile)
Tagged image "c5ffba5f4914d4701522b541b56cb1d5bd1bb467" as "registry.heroku.com/aframe-wiki/web"
Using default tag: latest
The push refers to repository [registry.heroku.com/aframe-wiki/web]
49446418c0f0: Preparing
d581c34c8b7b: Preparing
e7eb6e384cac: Preparing
ac03c9c3f77e: Preparing
59f3af9ccc89: Preparing
5d429640a7c0: Preparing
724865ab9b3f: Preparing
5f70bf18a086: Preparing
2a1c325e1fb4: Preparing
61f945ebd234: Preparing
0c56cb2aff7a: Preparing
44a4ced26d67: Preparing
3e207b409db3: Preparing
5d429640a7c0: Waiting
724865ab9b3f: Waiting
5f70bf18a086: Waiting
2a1c325e1fb4: Waiting
61f945ebd234: Waiting
0c56cb2aff7a: Waiting
44a4ced26d67: Waiting
3e207b409db3: Waiting
e7eb6e384cac: Pushed
ac03c9c3f77e: Pushed
d581c34c8b7b: Pushed
49446418c0f0: Pushed
59f3af9ccc89: Pushed
5f70bf18a086: Pushed
61f945ebd234: Pushed
724865ab9b3f: Pushed
2a1c325e1fb4: Pushed
0c56cb2aff7a: Pushed
3e207b409db3: Pushed
44a4ced26d67: Pushed
5d429640a7c0: Pushed
latest: digest: sha256:a637ee1d7a4f3315f94ed0c65a36a7945c5b12691de45728fce355e50363fb62 size: 3042
@kylebakerio
Copy link
Author

This is the activity feed for the heroku app, and as you can see, it looks like the DATABASE_URL step appears to be (attempted to be?) done automatically:

heroku-activity

@kylebakerio
Copy link
Author

I see this referenced on that git repo, but don't know if I should just abandon this all and attempt a second shot following those instructions: requarks/wiki-heroku#22

For now, will wait for more info on this issue.

@kylebakerio
Copy link
Author

Following a google, I found this page: https://devcenter.heroku.com/articles/config-vars

Following those instructions, I do ineed see:
DATABASE_URL set to a value that looks legit, following this pattern: postgres://<letters>:<letters-and-numbers>@ec2-<numbers>.compute-1.amazonaws.com:<numbers>/<letters-and-numbers>

@kylebakerio
Copy link
Author

kylebakerio commented Jan 24, 2021

Looking at the settings URI for my postgres resource, I see that it does indeed match the value for the heroku project's DATABASE_URL. So, no dice there. I had assumed this was the source of the problem, but that all looks solid.

The question is, then, what is undefined:undefined referring to in the line, Database Connection Error: 28000 undefined:undefined? Is it host, user, port, password? If so, how can I get those made available to the app properly in a way that stays in sync with the rotating database credentials heroku provides?

What went wrong here? Also, where can I find whatever script is running here?

@kylebakerio
Copy link
Author

kylebakerio commented Feb 3, 2021

I'm still eagerly awaiting feedback on this issue, have hacked in on it almost every day... @NGPixel, any thoughts on how to continue? I'd like to try the free heroku instance first before considering other options, I think this is an incredible way to make trying it out very approachable. I imagine it's a trivial fix, I am just not familiar with the piping here. Just a pointer at how/where the provisioning/scripting for the setup happening, or how to find out what the 'undefined:undefined' is so I can investigate further, would be helpful...

@gupuru
Copy link

gupuru commented Feb 4, 2021

I'm having the same problem.

undefined:undefined

I think "undefined:undefined" is output by the code here.

https://github.com/Requarks/wiki/blob/063251248c7a378fe6a8e6e69f47bf55fab88293/server/core/db.js#L174

@kylebakerio
Copy link
Author

let dbConfig = (!_.isEmpty(process.env.DATABASE_URL)) ? process.env.DATABASE_URL : {
  host: WIKI.config.db.host.toString(),
  user: WIKI.config.db.user.toString(),
  password: WIKI.config.db.pass.toString(),
  database: WIKI.config.db.db.toString(),
  port: WIKI.config.db.port
}

Looks like it's supposed to pick up the DATABASE_URL from the heroku environment variable here...

And it looks like it's done correctly, too, according to these docs: https://devcenter.heroku.com/articles/config-vars#accessing-config-var-values-from-code

@kylebakerio
Copy link
Author

hmm... this seems to be what we're running into: https://stackoverflow.com/a/19341505/4526479

@kylebakerio
Copy link
Author

I don't understand, though... that SO answer is from 2013. How can it have been broken for that long and still be broken?! Did this app deploy method just never work or something? But it's accepted and there are 21 upvotes... Surely we're just doing something wrong?

@kylebakerio
Copy link
Author

there's some possibility that this might be necessary, even though it shouldn't be: https://devcenter.heroku.com/articles/heroku-postgresql#establish-primary-db

It's at least something to try, I guess.

@kylebakerio
Copy link
Author

kylebakerio commented Feb 4, 2021

I'm a bit confused--I'm familiar with heroku, but not so much with docker... when I added the heroku git remote from my local machine, there seems to be nothing to 'pull', and so I can't trigger a redeploy by pushing anything because there's no branch to grab that I can see. What am I missing here?

That said, when I run heroku config I DO see === aframe-wiki Config Vars DATABASE_URL: postgres://qwxht...!

So... I don't know, maybe it was just undefined on the first run and would be ok if I could force a redeploy, in which case the initial run was just before heroku had finished provisioning/attaching the DB and that needs to be dealt with? If someone can point me how to deploy this particular app, let me know...

@gupuru
Copy link

gupuru commented Feb 4, 2021

I was now able to run wikijs on Heroku!

I specified the Heroku-postgressql version as 10.
So, the wikijs server is up and running.

heroku addons:create heroku-postgresql:hobby-dev --version=10

https://devcenter.heroku.com/articles/heroku-postgresql#version-support

スクリーンショット 2021-02-05 0 47 51

スクリーンショット 2021-02-05 0 48 52

スクリーンショット 2021-02-05 0 48 45

@kylebakerio
Copy link
Author

@gupuru so the problem is probably that no version is specified, and heroku now auto-deploys a newer version of pg than the wiki repo can handle?

Also, are you just running this command
heroku addons:create heroku-postgresql:hobby-dev --version=10
in the same repo, or...?
I tried running it in my local folder that has the heroku project I've been working on as the remote, and I'm getting the exact same logs as before. :/
Maybe I need to delete the old database?

@gupuru
Copy link

gupuru commented Feb 4, 2021

Maybe I need to delete the old database?

Yes. delete old database.

@gupuru
Copy link

gupuru commented Feb 4, 2021

delete the old database and use this repo .

https://github.com/Requarks/wiki-heroku

@kylebakerio
Copy link
Author

I found that the new database was added alongside the previous one, but added under a different process.env. So I deleted both, and will re-add it, and it was then added as the DATABASE_URL var now (since it's the only one after having deleted both the original and the one I just added).

And sure enough, it loads now!

Thanks!

@gupuru
Copy link

gupuru commented Feb 4, 2021

@kylebakerio 🎉

@foureyedraven
Copy link

Thank you for this thread!! Downgrading to 10 worked for me.

@kylebakerio
Copy link
Author

Keep in mind, after install, I found out that we're right on the cusp of a 3.0 release, which will add some really critical features. I am toying with 2.x in the background but waiting to release until 3.

@ThomasJRyan
Copy link

Thank you for your work @gupuru and @kylebakerio ! Turned a multi-hour struggle into about 10 minutes of getting things fixed up. Was a huge help!

@NGPixel
Copy link
Member

NGPixel commented Mar 1, 2021

Been trying to figure out what's causing this issue. Wiki.js works just fine with PostgreSQL 13 so there seems to be something specific to Heroku which prevents the DATABASE_URL env var from being passed to the process.

If somebody knows how to specify the db version as part of the manifest, to avoid having to run these manual commands, let me know.

@NGPixel NGPixel added the bug Something isn't working label Mar 1, 2021
@kajack
Copy link

kajack commented Mar 7, 2021

The issue is rather fishy. I did a setup and let the installation run by almost 2 weeks without touching it. Guess? It went back to failing to connect to database. Even though it was PSQL 10.

I'm starting to doubt it has something to do with the version of the PSQL but more how the connection is handled.

@kylebakerio
Copy link
Author

My install has worked fine since the changes I made (still working).

@kylebakerio
Copy link
Author

It definitely seems to be Heroku specific and like a potential bug on their end. Might be worth discussing with them?

Where is the heroku manifest file, @NGPixel ?

@NGPixel
Copy link
Member

NGPixel commented Mar 7, 2021

@clayton-franceschetto
Copy link

clayton-franceschetto commented Mar 8, 2021

The issue is rather fishy. I did a setup and let the installation run by almost 2 weeks without touching it. Guess? It went back to failing to connect to database. Even though it was PSQL 10.

I'm starting to doubt it has something to do with the version of the PSQL but more how the connection is handled.

Same problem here. I normally used my app on heroku last friday (03-05), but today I received this unpleasant surprise.
heroku-error

@kylebakerio
Copy link
Author

kylebakerio commented Mar 8, 2021

What do your logs say? I just double checked, mine is still working perfectly.

@clayton-franceschetto
Copy link

Here is the log. It appears to be the reported database problem.

2021-03-08T01:00:04.427900+00:00 app[web.1]: 2021-03-08T01:00:04.427Z [MASTER] �[33mwarn�[39m: Will retry in 3 seconds... [Attempt 9 of 10]
2021-03-08T01:00:07.428916+00:00 app[web.1]: 2021-03-08T01:00:07.428Z [MASTER] �[32minfo�[39m: Connecting to database...
2021-03-08T01:00:07.434933+00:00 app[web.1]: 2021-03-08T01:00:07.434Z [MASTER] �[31merror�[39m: Database Connection Error: 28000 undefined:undefined
2021-03-08T01:00:07.435065+00:00 app[web.1]: 2021-03-08T01:00:07.434Z [MASTER] �[33mwarn�[39m: Will retry in 3 seconds... [Attempt 10 of 10]
2021-03-08T01:00:10.436712+00:00 app[web.1]: 2021-03-08T01:00:10.436Z [MASTER] �[32minfo�[39m: Connecting to database...
2021-03-08T01:00:10.443087+00:00 app[web.1]: 2021-03-08T01:00:10.442Z [MASTER] �[31merror�[39m: Database Initialization Error: no pg_hba.conf entry for host "3.86.230.151", user "kjhabssairnhei", database "d89fdu7030d08m", SSL off
2021-03-08T01:00:10.490077+00:00 heroku[web.1]: Process exited with status 1
2021-03-08T01:00:10.560388+00:00 heroku[web.1]: State changed from starting to crashed
2021-03-08T01:58:54.241758+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=xyz.herokuapp.com request_id=f5de1665-486f-4f65-8b56-854e499b0517 fwd="179.216.206.6" dyno= connect= service= status=503 bytes= protocol=https
2021-03-08T01:58:56.103411+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=xyz.herokuapp.com request_id=2e340a65-98c8-442c-abf5-6866f891a043 fwd="179.216.206.6" dyno= connect= service= status=503 bytes= protocol=https
2021-03-08T02:03:18.122100+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=xyz.herokuapp.com request_id=8a67bdfb-62cc-4016-b613-42e2d47c26fe fwd="179.216.206.6" dyno= connect= service= status=503 bytes= protocol=https
2021-03-08T02:03:18.319426+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=xyz.herokuapp.com request_id=ec6f8720-b1c9-46a1-956d-62f1dfecd04a fwd="179.216.206.6" dyno= connect= service= status=503 bytes= protocol=https
2021-03-08T02:03:19.575746+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=xyz.herokuapp.com request_id=351a3f22-ac44-4f94-9b35-5a7cad326617 fwd="179.216.206.6" dyno= connect= service= status=503 bytes= protocol=https
wiki-js-heroku.txt

What do your logs say? I just double checked, mine is still working perfectly.

@clayton-franceschetto
Copy link

I was now able to run wikijs on Heroku!

I specified the Heroku-postgressql version as 10.
So, the wikijs server is up and running.

heroku addons:create heroku-postgresql:hobby-dev --version=10

https://devcenter.heroku.com/articles/heroku-postgresql#version-support

スクリーンショット 2021-02-05 0 47 51 スクリーンショット 2021-02-05 0 48 52 スクリーンショット 2021-02-05 0 48 45

So, the adjustment worked here. But how can I restore database from the broken application to a new one, when postgresql has been downgrade?

@Johann-L-Pickard
Copy link

I was now able to run wikijs on Heroku!
I specified the Heroku-postgressql version as 10.
So, the wikijs server is up and running.

heroku addons:create heroku-postgresql:hobby-dev --version=10

https://devcenter.heroku.com/articles/heroku-postgresql#version-support
スクリーンショット 2021-02-05 0 47 51
スクリーンショット 2021-02-05 0 48 52
スクリーンショット 2021-02-05 0 48 45

So, the adjustment worked here. But how can I restore database from the broken application to a new one, when postgresql has been downgrade?

You can use pgadmin backup and restore. What I did was to create a completely new deployment, then attach a db with v10, then delete the v13 one, then backup from the original databaase, then restore to the newly created 10 db

@clayton-franceschetto
Copy link

I was now able to run wikijs on Heroku!
I specified the Heroku-postgressql version as 10.
So, the wikijs server is up and running.

heroku addons:create heroku-postgresql:hobby-dev --version=10

https://devcenter.heroku.com/articles/heroku-postgresql#version-support
スクリーンショット 2021-02-05 0 47 51
スクリーンショット 2021-02-05 0 48 52
スクリーンショット 2021-02-05 0 48 45

So, the adjustment worked here. But how can I restore database from the broken application to a new one, when postgresql has been downgrade?

You can use pgadmin backup and restore. What I did was to create a completely new deployment, then attach a db with v10, then delete the v13 one, then backup from the original databaase, then restore to the newly created 10 db

I tried something like this, but I got some errors when restoring the database backup from v12 to v10, but using only heroku cli and her tools. I'll try pgadmin

@clayton-franceschetto
Copy link

I was now able to run wikijs on Heroku!
I specified the Heroku-postgressql version as 10.
So, the wikijs server is up and running.

heroku addons:create heroku-postgresql:hobby-dev --version=10

https://devcenter.heroku.com/articles/heroku-postgresql#version-support
スクリーンショット 2021-02-05 0 47 51
スクリーンショット 2021-02-05 0 48 52
スクリーンショット 2021-02-05 0 48 45

So, the adjustment worked here. But how can I restore database from the broken application to a new one, when postgresql has been downgrade?

You can use pgadmin backup and restore. What I did was to create a completely new deployment, then attach a db with v10, then delete the v13 one, then backup from the original databaase, then restore to the newly created 10 db

I tried that, but it didn't work for me. Differences between database users (source v12 and target v10) generate many permission errors.

@hamptonsmith
Copy link

hamptonsmith commented Mar 9, 2021

I don't think this issue is specifically with Heroku, but rather because Wiki.js tries to be clever with Heroku's DATABASE_URL env variable, which isn't the normal way to configure this.

Basically, when DATABASE_URL is set, dbConfig ends up as a string rather than an object and the normal SSL setup logic doesn't fire.

You can reproduce this off Heroku just by setting the DATABASE_URL env variable and pointing it at a database that needs SSL. There's no way to turn on SSL (because config.db.ssl is ignored) and similarly no way to turn off MITM protection (needed because Heroku uses self signed certs for Postgres).

Running wiki.js via a script that does unset DATABASE_URL, then configuring database via the normal config.db mechanism works:

db:
    type: postgres
    host: '$(DB_HOST)'
    port: '$(DB_PORT)'
    user: '$(DB_USER)'
    pass: '$(DB_PASS)'
    db: '$(DB_NAME)'
    ssl: true
    sslOptions:
        auto: false
        rejectUnauthorized: false # Heroku uses a self-signed cert

@NGPixel
Copy link
Member

NGPixel commented Mar 9, 2021

@hamptonsmith DATABASE_URL is the recommended way to connect to the Heroku DB, not via an object, as specified in https://devcenter.heroku.com/articles/heroku-postgresql#connecting-in-node-js

However, one interesting bit is they mention setting the ssl verify to false by setting an env var:

Alternatively, you can omit the ssl configuration object if you specify the PGSSLMODE config var:
heroku config:set PGSSLMODE=no-verify.

@NGPixel
Copy link
Member

NGPixel commented Mar 9, 2021

Added the PGSSLMODE env var to the heroku dockerfile and it now deploys successfully.

@NGPixel NGPixel closed this as completed Mar 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

9 participants