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

401 response ton /manifest request not returning error code for API call to Enketo #34

Open
pbowen-oc opened this issue Jun 28, 2023 · 4 comments
Assignees
Milestone

Comments

@pbowen-oc
Copy link

When we call a PDF endpoint to create a PDF of a form, we are sometimes not able to handle the /manifest call from Enketo and returning 401 for it. In these cases, the form cannot be returned as a PDF but we are not getting an error code response to indicate this. The expectation is that the call to Enketo will return an error code if the form cannot be returned as a PDF.

@pbowen-oc pbowen-oc added this to the Next milestone Jun 28, 2023
@MartijnR
Copy link
Member

MartijnR commented Jul 11, 2023

readonly view: http://localhost:8005/view/fs/i/bc779317d111a78dba079c30335325b2?ecid=1

PDF:

curl --user enketorules: -d "server_url=http://localhost:3000&form_id=slash&ecid=1"  http://localhost:8005/oc/api/v1/survey/view/pdf > ~/Downloads/pdf1.pdf

PDF URL used internally by the PDF API endpoint: http://localhost:8005/view/fs/bc779317d111a78dba079c30335325b2?ecid=1&print=true

In Centro's form.js, let manifest controller return a 401:

.then( manifest => {
                //res.send( manifest.toString() );
                res.status(401);
                res.end()
            } )

@MartijnR
Copy link
Member

MartijnR commented Jul 11, 2023

Notes to self:

Succeeded in inspecting requests and finding a 401 response. Still figuring out how to properly reject/throw an error so that it can be caught. I have a feeling that the code in headless.js also is not catching errors (hence the old comments 'unable to reach) in that code.

  • create fix (since we've deviated already in pdf.js and still need to offer that to enketo/enketo-express)
  • create PR for enketo/enketo-express with all pdf.js changes (after testing by OC?) - Fix/various pdf fixes enketo/enketo-express#577

MartijnR referenced this issue in OpenClinica/enketo-express-oc Jul 12, 2023
kobotoolbox#688

fixed: a headless chrome instance will now be kept alive at all times so pdf responses should be quicker
@MartijnR
Copy link
Member

MartijnR commented Jul 12, 2023

Please leave open for last bullet point (done)

@MartijnR
Copy link
Member

MartijnR commented Aug 16, 2023

  • See ODK PR feedback and improve

@MartijnR MartijnR transferred this issue from OpenClinica/enketo-express-oc May 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants