grist-core
grist-core copied to clipboard
Issue: URL for published form throws an error
Function/Service
Forms
Issue
Updated to the latest version of grist today. It is running as a container in my self-hosted server. I tried the new forms functionality and created a form and published it. The link generated as part of the preview works fine, the data I key in gets saved in the appropriate table. However, when I try the link from the 'Copy Link' option in the form I get a page as shown in the screengrab.
Error message
There was an error: Unexpected token < in JSON at position 0.
Screenshot
Thanks for reporting @nsmathew.
Could you share the link that was copied to your clipboard, excluding/censoring the shareKey
part from the example below?
https://docs.getgrist.com/forms/${shareKey}/123
Sure, it is https://mydomain.com/forms/<xxx>/258
Thanks. Shape of the URL looks right to me.
Any chance you see an error trace in the server logs?
This gets printed once I try to open the link
Thanks for the screenshot. A few lines just before the first line in your screenshot, there should be a line starting with GET /api/s/...
. What's the status code you see for that request? Can you try dropping that path in front of your domain in the browser (e.g. https://mydomain.com/api/s/<xxx>/forms/258
) and see if you get to the form page? Think I've narrowed down the problem but not positive yet.
Had a look but I don't see any such lines in the docker logs.
We have the same issue. Form Preview works and populates the table but the published link (https://mydomain.com/forms/
A minor difference: the error message is "Fetch failed".
@gdedrouas I also have encountered this issue in a local environment (in our production though we have a different issue). In our case, it's because the hostname of public URL for the home server cannot be resolved behind the reverse proxy.
That's something I meant to fix through this issue at first: https://github.com/gristlabs/grist-core/pull/864/files
It would mean that you would have to set a new env variable (at least in my case, it would solve my issue): APP_HOME_INTERNAL_URL
.
But I was told that the guilty piece of code requiring that would probably be changed soon so this new env variable would not be necessary. So probably the PR I can close this PR @paulfitz?
I can confirm that the request to "/api/s..." is never made. getHomeUrl fails in our environment.
Getting same issue here in local environment, however, unlike @gdedrouas, I can view the preview form and submit, but it does not populate the table.
The next sync to main
(slated for early next week) will include a fix. Will report here once it's available.
The sync of grist-saas code @georgegevoian mentioned happened this morning. The relevant change I think is this one: https://github.com/gristlabs/grist-core/commit/c6fd79ac1f08ab4146e3bca400325052b4ad257e
Maybe @georgegevoian can give more context. Sorry for how opaque this change was, we are slowly moving more development over to grist-core but it is still a work in progress.
The latest
image should now have the changes.
It's part of a broader refactor of forms, to more closely align with the other client-side Grist code. All forms API requests are now routed through DocApiForwarder, which should do a better job at building URLs that the home server can actually reach. I'm not sure if it'll address all of the issues (e.g. the submission issue @StreamlinedStartup reported, which may be unrelated), but please give it a try and let us know how it fares.
It fixes the Fetch failed
error I got when running local kubernetes pods! :)
Though the problem is different from the access denied
error we have on our production (but we will give it a try at least to check), and for which we need to diagnose.
It also fixes the Fetch failed error we got. Much appreciated.