ODK Central: create new form draft 404s back to index

1. What is the problem? Be very detailed.
Any form draft 404s and redirects to the index page. Tried across several projects and forms.

2. What app or server are you using and on what device and operating system? Include version numbers.

ODK Central on an Azure VM with dedicated Azure Postgres DB.
I've just upgraded to 1.2 (latest), ran into problems with the SSL certificate for the DB, downgraded to tags/v1.1.2, rebuilt and restarted the images.

versions:
86d3ebc27ca8e3feb1b6a107da7f8f4fbb21f3f1
 cddb691e40e84aabff87b9d427e22a50282d6f99 client (v1.1.2)
 a33bc6fb3c34fe38894b0e9d0bb404f81da325e6 server (v1.1.1)

3. What you have you tried to fix the problem?
Read logs, restarted server, hit the URL /draft manually.

4. What steps can we take to reproduce the problem?
Verify on my server. Account on request.

5. Anything else we should know or have? If you have a test form or screenshots or logs, attach below.

server logs via docker-compose logs -f service nginx:

service               | ::ffff:172.18.0.9 - - [09/Aug/2021:03:45:52 +0000] "GET /v1/projects/3 HTTP/1.0" 200 874
nginx                 | 172.30.1.9 - - [09/Aug/2021:03:45:52 +0000] "GET /v1/projects/3 HTTP/1.1" 200 874 "https://odkc.dbca.wa.gov.au/" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:90.0) Gecko/20100101 Firefox/90.0"
service               | ::ffff:172.18.0.9 - - [09/Aug/2021:03:45:52 +0000] "GET /v1/projects/3/forms HTTP/1.0" 200 776
nginx                 | 172.30.1.10 - - [09/Aug/2021:03:45:52 +0000] "GET /v1/projects/3/forms HTTP/1.1" 200 776 "https://odkc.dbca.wa.gov.au/" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:90.0) Gecko/20100101 Firefox/90.0"
service               | ::ffff:172.18.0.9 - - [09/Aug/2021:03:45:53 +0000] "GET /v1/projects/3/forms/Locations/draft/attachments HTTP/1.0" 404 76
nginx                 | 172.30.1.10 - - [09/Aug/2021:03:45:53 +0000] "GET /v1/projects/3/forms/Locations/draft/attachments HTTP/1.1" 404 76 "https://odkc.dbca.wa.gov.au/" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:90.0) Gecko/20100101 Firefox/90.0"
service               | ::ffff:172.18.0.9 - - [09/Aug/2021:03:45:53 +0000] "GET /v1/projects/3/forms/Locations/draft HTTP/1.0" 404 76
nginx                 | 172.30.1.9 - - [09/Aug/2021:03:45:53 +0000] "GET /v1/projects/3/forms/Locations/draft HTTP/1.1" 404 76 "https://odkc.dbca.wa.gov.au/" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:90.0) Gecko/20100101 Firefox/90.0"
nginx                 | 172.30.1.10 - - [09/Aug/2021:03:45:53 +0000] "GET /v1/projects/3/forms/Locations HTTP/1.1" 200 774 "https://odkc.dbca.wa.gov.au/" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:90.0) Gecko/20100101 Firefox/90.0"
service               | ::ffff:172.18.0.9 - - [09/Aug/2021:03:45:53 +0000] "GET /v1/projects/3/forms/Locations HTTP/1.0" 200 774
service               | ::ffff:172.18.0.9 - - [09/Aug/2021:03:45:54 +0000] "POST /v1/projects/3/forms/Locations/draft HTTP/1.0" 200 16
nginx                 | 172.30.1.10 - - [09/Aug/2021:03:45:54 +0000] "POST /v1/projects/3/forms/Locations/draft HTTP/1.1" 200 16 "https://odkc.dbca.wa.gov.au/" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:90.0) Gecko/20100101 Firefox/90.0"
nginx                 | 172.30.1.10 - - [09/Aug/2021:03:45:55 +0000] "GET /v1/projects/3/forms/Locations/versions HTTP/1.1" 200 1165 "https://odkc.dbca.wa.gov.au/" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:90.0) Gecko/20100101 Firefox/90.0"
service               | ::ffff:172.18.0.9 - - [09/Aug/2021:03:45:55 +0000] "GET /v1/projects/3/forms/Locations/versions HTTP/1.0" 200 1165
service               | [2021-08-09T03:45:55.326Z] start processing event form.update.draft.set::2021-08-09T03:45:50.085Z::db0e0841-5aff-4f20-80ab-c9cc856923f9 (1 jobs)
service               | [2021-08-09T03:45:55.356Z] finish processing event form.update.draft.set::2021-08-09T03:45:50.085Z::db0e0841-5aff-4f20-80ab-c9cc856923f9
service               | [2021-08-09T03:45:55.363Z] start processing event form.update.draft.set::2021-08-09T03:45:54.873Z::290228f5-b28b-4d86-9b4a-746df4b51cf8 (1 jobs)
service               | [2021-08-09T03:45:55.392Z] finish processing event form.update.draft.set::2021-08-09T03:45:54.873Z::290228f5-b28b-4d86-9b4a-746df4b51cf8

I'm actually not sure it's really possible to downgrade from v1.2 to v1.1. When you migrate from v1.1 to v1.2, that makes changes to the database by running database migrations. I don't think there's a way to reverse those database migrations, so even if you check out the tags for v1.1, the structure of the database will still match v1.2 and won't match what the v1.1 code expects.

I think it's generally the case that downgrade isn't always possible, but I don't think we document that. I've filed a GitHub issue so that we can make that change to the docs: https://github.com/getodk/docs/issues/1381

We changed the database tables for forms and form versions (including form drafts) as part of v1.2, which is why I think this is related. Because the server is returning 404 for the form draft, the frontend isn't able to render any page for the form draft and instead redirects to the index page.

That in combination with lack of SSL support might have just broken our production server.

@Matthew_White be thanked, this could be a solution: https://github.com/getodk/central-backend/pull/394