Preview of old form gives "Survey with this ID not found" but newly created forms preview correctly

1. What is the issue? Please be detailed.
Standard docker compose install of ODK central on own server following the guidance on the ODK website. Has been running flawlessly for 3 years now. Using upstream SSL and reverse proxying but otherwise no customisation. Upgraded following the instructions carefully but somewhere between the last couple of upgrades all the existing forms could not be previewed as their survey ID could not be found. New forms created with current version of Central preview exactly as expected including copies of the old form definitions so it's not something in the forms themselves.

2. What steps can we take to reproduce this issue?
Take a pre-postgres14 central installation with forms and upgrade it to the latest version and see if the forms still preview.

3. What have you tried to fix the issue?
Can't find any trace of this problem in existing support queries. Can't find any way of regenerating the form preview IDs with Enketo though I suspect this would fix the issue.
Have checked the database upgrade log and there are no errors in it.
Have removed and recreated the containers. Pulled fresh files from the repository and rebuild the images. Checked through all the config files looking for something out of place.

4. Upload any forms or screenshots you can share publicly below.
versions:
ac3885e79dafa14a08c68d86546c4c0389fa1197 (v2023.3.1-1-gac3885e)
676b63a62652cec57b06b622a0ef36a58fa6d6e4 client (v2023.3.0)
ba6ee474f431b48e885fb035c9266792f06d0ad7 server (v2023.3.1)

Any help most gratefully received. Is there a way to get the system to regenerate new survey IDs for existing forms?

Thanks very much,
Bruce

Hi Bruce,

Welcome to the ODK Forum. Please introduce yourself here If you haven't done so already.

The issue could be due to the change of domain name between the upgrades, by any chance have you changed the domain name on which ODK Central is hosted?

1 Like

Thanks for the reply. No I haven't changed the domain at all.

A new bit of information though, the editing of submissions on the old forms works perfectly in Enketo. Also, if I extract the enketo form ID from the URL generated when editing a submission and insert it into the URL for the form preview, it works. So it's definitely an issue with the ID of the form rather than any server config. Somehow the ID being used for the preview button is not correct but the database does have the correct one in there somewhere as it uses the correct one for the submission edit.

Anyone know how I could either regenerate all enketo form IDs or edit the database to take the good ID and get it to be used for the preview URL?

Many thanks,
Bruce

Thanks for sharing more details! Would you be willing to share which pre-postgres 14 install you were upgrading from? That could give some clues.

You're talking about published form previews, not draft previews, right?

When you go to your form > Submissions and then click the + New button, does that work? The new submission link and preview link should be identical except for an added /preview part of the URL after -. Maybe comparing the + New and preview URLs could also give clues.

Is the behavior the same for all forms? Do you have any forms that only have one published version that you could try?

1 Like

I've been upgrading every time a new version was published so it would have been from v2023.1 to v2023.2. Unfortunately this coincided with a period where no one was doing any surveys so no one noticed there was an issue until I had further upgraded through to v2023.3.

Yes, these are published form previews that have the issue. New forms (created since v2023.03) work fine.

New submissions do indeed have the same link as the preview and they result in a "survey with this ID not found " message too. Editing a submission is fine though.

All forms have the same behaviour ( except ones created with v2023.3 ). I do have a form that has only one published version and it also gives a "survey with this ID not found" error.

Thanks again for your help.

I've been continuing to think about this and am very puzzled.

Enketo stores a mapping between its ids and form info. At form creation time, Central requests the Enketo id and stores it in its own database. That id is supposed to be stable so that you can send out links to web forms for example. "survey with this ID not found " implies that somehow one of those two ids has changed.

Edit links are requested dynamically by Central from Enketo. So it makes sense that this would work and it's certainly an interesting piece of information.

Do you have a web form URL from before this bad state somewhere? Like maybe you emailed out a direct link to a web form or sent one over WhatsApp or whatever? It would be very interesting to know whether it's Central or Enketo's id that is incorrect. Currently I can't imagine how either of them would have changed.

Sorry for the delay in replying, other things getting in the way. I have had a chat with the guys who design and use the forms and sadly they can't find an old web form URL. In case it helps, I can take the form ID out of the dynamically generated, form edit link and put it into the form preview URL and it works so it suggests that Central has the wrong form ID in its records. Without knowing how it works, I'd guess that somehow Enketo has generated new form IDs but of course they haven't propagated to Central as they weren't generated as part of the form creation process. How that could have happened I have no idea :-).
Thanks....