grist-core icon indicating copy to clipboard operation
grist-core copied to clipboard

error when duplicating document

Open tardisx opened this issue 3 years ago • 1 comments

When I go to the share menu and choose "Duplicate document", choose a new name and press "Save", I see a popup in the UI:

Request to https://grist.mydomain.com/dw/self/v/unknown/o/docs/copy?doc=orG7eYs3udYdCy8RiraKiX&name=test2.grist failed with status 404: (unknown cause)

The logs (docker logs) show:

2022-04-13 22:07:07.768 - debug: Auth[GET]: grist.mydomain.com /worker/import customHostSession=, method=GET, host=grist.mydomain.com, path=/worker/import, org=docs, [email protected], userId=6, altSessionId=7Tudfk6cdFeHeR6USLJCUN
2022-04-13 22:07:07.778 - debug: Auth[POST]: grist.mydomain.com /copy customHostSession=, method=POST, host=grist.mydomain.com, path=/copy, org=docs, [email protected], userId=6, altSessionId=7Tudfk6cdFeHeR6USLJCUN
2022-04-13 22:07:07.783 - debug: Auth[GET]: grist.mydomain.com /worker/orG7eYs3udYdCy8RiraKiX customHostSession=, method=GET, host=grist.mydomain.com, path=/worker/orG7eYs3udYdCy8RiraKiX, org=docs, [email protected], userId=6, altSessionId=7Tudfk6cdFeHeR6USLJCUN
2022-04-13 22:07:07.802 - debug: Auth[POST]: grist.mydomain.com /log customHostSession=, method=POST, host=grist.mydomain.com, path=/log, org=docs, [email protected], userId=6, altSessionId=7Tudfk6cdFeHeR6USLJCUN
2022-04-13 22:07:07.803 - warn: client error message=Request to https://grist.mydomain.com/dw/self/v/unknown/o/docs/copy?doc=orG7eYs3udYdCy8RiraKiX&name=test2.grist failed with status 404:  (unknown cause), status=404, , line=37, column=256113, sourceURL=https://grist.mydomain.com/v/unknown/main.bundle.js, stack=i@https://grist.mydomain.com/v/unknown/main.bundle.js:37:256113
u@https://grist.mydomain.com/v/unknown/main.bundle.js:12:573748
@https://grist.mydomain.com/v/unknown/main.bundle.js:12:572984
generatorResume@[native code]
s@https://grist.mydomain.com/v/unknown/main.bundle.js:12:570925
promiseReactionJob@[native code], page=https://grist.mydomain.com/o/docs/orG7eYs3udYd/test1, language=en-AU, platform=MacIntel, userAgent=Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/15.4 Safari/605.1.15, org=docs, [email protected], userId=6, altSessionId=7Tudfk6cdFeHeR6USLJCUN

I am running via docker-compose with the following environment:

      - APP_HOME_URL=https://grist.mydomain.com
      - GRIST_PROXY_AUTH_HEADER=X-WEBAUTH-USER
      - GRIST_DOMAIN=grist.mydomain.com

using image gristlabs/grist:latest (5294d77b18ce). I get the same behaviour on the grist:0.7.8 image.

I have masked my real domain and email in the logs. Grist otherwise operates normally with respect to creating and updating documents.

tardisx avatar Apr 13 '22 22:04 tardisx

Hi @tardisx, thanks for reporting this. I confirm that I see this too. Looks like a url construction problem when using a fixed domain with teams/orgs encoded in the url. As a workaround, if you don't need multiple teams/orgs, copying appears to be working ok when GRIST_SINGLE_ORG is set. Will work on getting this fixed.

paulfitz avatar Apr 14 '22 01:04 paulfitz

Same issue in our self-hosted.

Here the message in the logs:

2022-11-17 17:28:52.331 - warn: client error fileName=https://grist.incubateur.anct.gouv.fr/v/unknown/main.bundle.js, lineNumber=2, columnNumber=346242, message=Request to https://grist.incubateur.anct.gouv.fr/dw/self/v/unknown/o/anct/copy?doc=XXXXXXX&name=Suivi+des+actions+%28copy%29.grist failed with status 404: Not Found (unknown cause), status=404, , docId=XXXXXXX, page=https://grist.incubateur.anct.gouv.fr/o/anct/YYYYYYY/Suivi-des-actions, language=fr-FR, platform=Linux x86_64, userAgent=Mozilla/5.0 (X11; Linux x86_64; rv:107.0) Gecko/20100101 Firefox/107.0, org=anct, [email protected], userId=6, altSessionId=ZZZZZZZZ

Any clue where to dig so we can try to fix it ? :)

cc @LouisDelbosc :)

yohanboniface avatar Nov 17 '22 17:11 yohanboniface

Same issue here too, and the workaround from @paulfitz works well.

jperon avatar Nov 17 '22 18:11 jperon

Sorry this problem persists, I thought it was sorted out.

@LouisDelbosc if you are up for investigating, the first place to look I'd say is in the implementation of the /copy endpoint, here https://github.com/gristlabs/grist-core/blob/619cd91dea5cc8a21003a1ead62d1a036d2cda6e/app/server/lib/uploads.ts#L69-L89

There is a point where the original document is fetched from whatever server is hosting it, here: https://github.com/gristlabs/grist-core/blob/619cd91dea5cc8a21003a1ead62d1a036d2cda6e/app/server/lib/uploads.ts#L418

This should be simple in a single-server installation, but it could be getting it wrong. Adding debugging messages around here give some information.

paulfitz avatar Nov 17 '22 19:11 paulfitz