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

Issue: URL for published form throws an error #845

Open
nsmathew opened this issue Feb 6, 2024 · 15 comments
Open

Issue: URL for published form throws an error #845

nsmathew opened this issue Feb 6, 2024 · 15 comments
Labels
forms feedback for the forms feature

Comments

@nsmathew
Copy link

nsmathew commented Feb 6, 2024

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

NVIDIA_Share_keb5FGxPWV

@georgegevoian
Copy link
Contributor

georgegevoian commented Feb 6, 2024

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

@nsmathew
Copy link
Author

nsmathew commented Feb 6, 2024

Sure, it is https://mydomain.com/forms/<xxx>/258

@georgegevoian
Copy link
Contributor

Thanks. Shape of the URL looks right to me.

Any chance you see an error trace in the server logs?

@nsmathew
Copy link
Author

nsmathew commented Feb 6, 2024

This gets printed once I try to open the link
image

@georgegevoian
Copy link
Contributor

georgegevoian commented Feb 6, 2024

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.

@nsmathew
Copy link
Author

nsmathew commented Feb 6, 2024

Had a look but I don't see any such lines in the docker logs.

@gdedrouas
Copy link

gdedrouas commented Feb 23, 2024

We have the same issue. Form Preview works and populates the table but the published link (https://mydomain.com/forms//1) returns a 400 error. It's self-hosted, behind an apache reverse proxy, we encounter no other issues. I'll post further debugging logs if it helps anyone.

A minor difference: the error message is "Fetch failed".

@fflorent
Copy link
Collaborator

@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?

@gdedrouas
Copy link

I can confirm that the request to "/api/s..." is never made. getHomeUrl fails in our environment.

@StreamlinedStartup
Copy link

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.

@georgegevoian
Copy link
Contributor

The next sync to main (slated for early next week) will include a fix. Will report here once it's available.

@paulfitz
Copy link
Member

The sync of grist-saas code @georgegevoian mentioned happened this morning. The relevant change I think is this one:
c6fd79a

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.

@georgegevoian
Copy link
Contributor

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.

@fflorent
Copy link
Collaborator

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.

@gdedrouas
Copy link

It also fixes the Fetch failed error we got. Much appreciated.

@fflorent fflorent added the forms feedback for the forms feature label Sep 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
forms feedback for the forms feature
Projects
None yet
Development

No branches or pull requests

6 participants