Skip to content

Instantly share code, notes, and snippets.

@vpasquier
Created June 7, 2021 19:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vpasquier/50d41f96759bbdfad7d6632d532316d7 to your computer and use it in GitHub Desktop.
Save vpasquier/50d41f96759bbdfad7d6632d532316d7 to your computer and use it in GitHub Desktop.

So the story is the following:

  • Direct download is always activated on NCO instances.
  • I have added this to our ai core package: https://jira.nuxeo.com/browse/AICORE-499 in order to solve the problem of CORS no redirect issue with pdfjs.

The original problem will be fixed with the change in the cors config of S3 (see ai-cloud channel).

  1. We have a bug on the AI.Suggestion operation that has an issue with the body of the automation operation.
  2. We have a bug on the pdf viewer here: https://nxdev-dev-ai.beta.nuxeocloud.com/nuxeo/ui/#!/browse/default-domain/workspaces/jira/nuxeo/NXP-30218

For the first problem:

It’s a marshalling issue:

2021-06-07T19:26:49,919 DEBUG [http-nio-0.0.0.0-8080-exec-28] [org.nuxeo.ecm.webengine.app.WebEngineExceptionMapper] org.nuxeo.ecm.core.api.NuxeoException
org.nuxeo.ecm.core.api.NuxeoException: null
	at org.nuxeo.ecm.automation.core.util.JSONObjectBlobDecoder.getBlobFromURL(JSONObjectBlobDecoder.java:79) ~[nuxeo-automation-core-10.10-HF44.jar:?]
	at org.nuxeo.ecm.automation.core.util.JSONObjectBlobDecoder.getBlobFromJSON(JSONObjectBlobDecoder.java:62) ~[nuxeo-automation-core-10.10-HF44.jar:?]
	at org.nuxeo.ecm.automation.core.util.ComplexTypeJSONDecoder.getBlobFromJSON(ComplexTypeJSONDecoder.java:143) ~[nuxeo-automation-core-10.10-HF44.jar:?]
	at org.nuxeo.ecm.automation.core.io.BlobJsonReader.read(BlobJsonReader.java:40) ~[nuxeo-automation-core-10.10-HF44.jar:?]
	at org.nuxeo.ecm.automation.core.io.BlobJsonReader.read(BlobJsonReader.java:34) ~[nuxeo-automation-core-10.10-HF44.jar:?]
	at org.nuxeo.ecm.core.io.marshallers.json.AbstractJsonReader.read(AbstractJsonReader.java:80) ~[nuxeo-core-io-10.10-HF44.jar:?]
	at org.nuxeo.ecm.core.io.marshallers.json.AbstractJsonReader.readEntity(AbstractJsonReader.java:128) ~[nuxeo-core-io-10.10-HF44.jar:?]
	at org.nuxeo.ecm.core.io.marshallers.json.document.DocumentPropertiesJsonReader.readProperty(DocumentPropertiesJsonReader.java:150) ~[nuxeo-core-io-10.10-HF44.jar:?]
	at org.nuxeo.ecm.core.io.marshallers.json.document.DocumentPropertiesJsonReader.read(DocumentPropertiesJsonReader.java:129) ~[nuxeo-core-io-10.10-HF44.jar:?]
	at org.nuxeo.ecm.core.io.marshallers.json.document.DocumentPropertiesJsonReader.read(DocumentPropertiesJsonReader.java:89) ~[nuxeo-core-io-10.10-HF44.jar:?]
	at org.nuxeo.ecm.core.io.marshallers.json.AbstractJsonReader.read(AbstractJsonReader.java:80) ~[nuxeo-core-io-10.10-HF44.jar:?]
	at org.nuxeo.ecm.core.io.marshallers.json.AbstractJsonReader.readEntity(AbstractJsonReader.java:128) ~[nuxeo-core-io-10.10-HF44.jar:?]
	at org.nuxeo.ecm.core.io.marshallers.json.document.DocumentModelJsonReader.readEntity(DocumentModelJsonReader.java:108) ~[nuxeo-core-io-10.10-HF44.jar:?]
	at org.nuxeo.ecm.core.io.marshallers.json.document.DocumentModelJsonReader.readEntity(DocumentModelJsonReader.java:78) ~[nuxeo-core-io-10.10-HF44.jar:?]
	at org.nuxeo.ecm.core.io.marshallers.json.EntityJsonReader.read(EntityJsonReader.java:66) ~[nuxeo-core-io-10.10-HF44.jar:?]

-> Nuxeo marshalling bug on the platform.

For the second problem:

-> https://nxdev-dev-ai.beta.nuxeocloud.com/nuxeo/ui/#!/browse/default-domain/workspaces/jira/nuxeo/NXP-30218

the pdf js is not fetching correctly the file - here is the call stack:

Caller: https://nxdev-dev-ai.beta.nuxeocloud.com/nuxeo/ui/bower_components/nuxeo-ui-elements/viewers/pdfjs/web/viewer.html?file=https://nuxeo-app-dev-ai-0dee760bae.s3.eu-west-1.amazonaws.com/binaries/7ef290a123de074284cbaed01478a7e6?response-content-disposition=attachment%253B%2520filename%253DNXP-30218.pdf&response-content-type=application%252Fpdf&X-Amz-Security-Token=IQoJb3JpZ2luX2VjEKf%252F%252F%252F%252F%252F%252F%252F%252F%252F%252FwEaCWV1LXdlc3QtMSJGMEQCIHasQCtiRtkMFfW4K57YkANGbjIfxBBs………

Then the pdf calls: https://nuxeo-app-dev-ai-0dee760bae.s3.eu-west-1.amazonaws.com/binaries/7ef290a123de074284cbaed01478a7e6?response-content-disposition

which is missing the link signature (all the parameters after the disposition param). So it seems to be an error on the pdf js library or a nuxeo element, not sure -> will see with Nelson tomorrow if I can’t find something later.

Workaround for all:

  • The solution would be to deactivate the global non redirect
  • To create an enricher when we really want to have the S3 direct link
  • To call this enricher only for annotation screen
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment