Chapter 9: Can't execute the revert command

After using
“vapor cloud run "revert --all --yes”
nothing is happening. DB is not reverting, and I am getting 500 error when I am fetching all acronyms (as expected)

@sergey_dmitriev if you run vapor cloud logs --since=12h do you get any errors. And if you run it a few times do you get any errors?

If you get a 500 error when getting all the acronyms you would expect an error since there should be no DB. This may be a memory issue that I’ve seen cropping up when you try and run the command with the app running

@sergey_dmitriev and @0xtim, did you ever sort this out? I’m having a similar issue. The revert is not working. The database is unaffected still has all the previous data and structure.

@foamx I deleted postgres db and created it again. Then I deployed again with clear build option.

1 Like

@0xtim I tried this, but didn’t get any errors. I read your answers in Discord threads, and tried everything :slight_smile: thanks))

Btw, I didn’t use the beta branch (as it is written in the book), but release version.

I will wait the next version of the ea and re-check)

This is a known issue and should be fixed with a memory improvement in Vapor Cloud. Basically the current free container is too close to the memory limit, so when you run the revert it takes up too much memory and fails. A change in the Vapor Cloud container is coming which reduces the memory footprint. If you try deploying again and then reverting again in a couple of days this issue should be fixed.

The workaround for now is to delete the database from the dashboard in Vapor Cloud and create a new one when you deploy.

@sergey_dmitriev How did you delete the DB and created it again on vapor cloud?

@bunschoten if you go to dashboard.vapor.cloud you can click through to your hosting and then find the DB. Click the red X in the corner to delete the DB

@0xtim Can’t find the red X :frowning:
See screenshot

BTW: The “View” link leads to a 404 page.

Ah sorry, click through to Edit through the pencil in the top right and the red X will be there

I’m still having this issue in December. After running vapor cloud run "revert --all --yes" the DB was not reverted. I deployed and then got 503s until I deleted the database.

@senior what does your cloud.yml look like?

type: “vapor”
swift_version: “4.1.0”
run_parameters: “serve --port 8080 --hostname 0.0.0.0”

What errors are you getting when you try and revert?

No errors, it just echoes

app: TIL
env: production
Running '.build/release/Run --env=production revert --all --yes'

But it doesn’t give any of the output that the book shows, including the success message.

Hmm that sounds like a memory error, but it should be OK for the TIL app. When was the last time you did a proper deploy?

One option you have is to delete the database via the dashboard, it’s a bit of a nuclear option. Maybe @jonasschwartz can advise if that doesn’t work

By “proper” do you mean a non-incremental deploy? Several chapters ago :^)

I ended up having to delete the database. It resolved the problem, but as you said it was a nuclear option. Are there any other suggestions for when this happens with a real application?

Btw, your book is amazing. Really great job!

Generally i think the problem leads back to memory cache in Leaf, that takes up quite a lot of memory on the free plans.
We have seen some apps on free plans getting killed because of memory limit when running commands.

Think we need to look into internally if we can do something, until Cloud 2 is released with more memory on the free plans :slight_smile:

I think if you do a deploy (any kind of deploy) and then run the revert without browsing to the site it should be OK. This will be because the Leaf cache won’t have been populated yet so the memory should still be low.

noted… i think this is the best way for now… alot user got this issue, how about if i want to setup a VPS dont use vapor cloud?