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

PREVIEW_RENDERING_FAILED #56

Open
r-modica-cti opened this issue Aug 23, 2023 · 16 comments
Open

PREVIEW_RENDERING_FAILED #56

r-modica-cti opened this issue Aug 23, 2023 · 16 comments

Comments

@r-modica-cti
Copy link

Not sure this is the correct place, but as the Adobe forums are not responsive adding here.

We have a site where the Adobe Embed API has been working well for months, but in the last week started popping up with the error PREVIEW_RENDERING_FAILED, which fails to even show an error message, instead we get a completely blank screen, this is intermittent, sometimes it will show the PDF fine, other times it seems to timeout the promise.

The files are loaded from an API and using a fileReader we are creating an ArrayBuffer, which has not changed in any way, and the files sometimes load and then sometimes we receive a blank screen and the PREVIEW_RENDERING_FAILED error. The files are not large, max is currently around 2MB and the only way I can consistently show the error is if I 3G throttle the connection, just seems to time out even with small files, but it is intermittent even on a non throttled connection, it is as if the promise resolution even though the file has been received is timing out.

The error seems to be thrown in ViewSDKInterfaceApp.js on the line which gets the exposed APIs but that could just be the browser interpretation, its the last place on the stack trace, which shows:

previewFile(fileInfo, previewConfig) {
        this._logExternal("Starting process to preview file.", fileInfo.metaData, previewConfig);
        return this._embedModeHandlerService
            .initialiseAction(fileInfo, previewConfig, IFrameMessageTypes.PREVIEW, hostAppStartTime)
            .then(() => this._adobeViewer.getExposedAPIs({ previewConfig }));
    }

There are also some XHR requests going to https://dc-api.adobe.io/system/log which seem to have some additional information:

{
  "level": "error",
  "message": "Error in preview, file rendering timeout",
  "sessionId": "41188030-6b8f-47f9-9ab2-3b6dca66d104",
  "viewSDKAppVersion": "REDACTED",
  "tenantId": "REDACTED",
  "callingApp": "dc-view-sdk",
  "externalUserId": "REDACTED",,
  "clientId": "REDACTED",
  "client_timestamp": "2023-08-22T19:45:58.200Z",
  "context": "AppStore"
}

And

{
  "level": "error",
  "message": "File preview blocked as preview failed to load REDACTED",
  "sessionId": "REDACTED",
  "viewSDKAppVersion": "3.2.4_3.2.0-bab76ff9",
  "tenantId": "REDACTED",
  "callingApp": "dc-view-sdk",
  "externalUserId": "REDACTED",
  "clientId": "REDACTED",
  "client_timestamp": "2023-08-22T19:45:58.253Z",
  "context": "App"
}

Our code is pretty standard I think based on the official documentation when dealing with a non url file, in our case from an API endpoint. the code has been working for months, its just started to happen this with no changes to the way this has been working.

Our fetch code looks like:

const fetchPDF = (id: string, title: string, pages: number) => {
    fetch(`/api/pdf/${id}`)
      .then((response) => response.blob())
      .then((blob) => {
        const reader = new FileReader();

        reader.onloadend = (e) => {
          const filePromise = Promise.resolve(e.target?.result)
          previewPDF(filePromise, title, pages)
        }

        reader.readAsArrayBuffer(blob)
      })
}

previewPDF function:

const previewPDF = (filePromise: any, title: string, pages: number) => {
  const adobeDCView = new AdobeDC.View({
    clientId: config.adobeApiKey,
    divId: `adobe-dc-view-${props.id}`,
  })
  adobeDCView.previewFile(
    {
      content: {
        promise: filePromise,
      },
      metaData: { fileName: title },
    },
    {
      embedMode:
        props.mode.toLowerCase() === 'lightbox' ? 'LIGHT_BOX' : 'IN_LINE',
      exitPDFViewerType:
        props.mode.toLowerCase() === 'lightbox' ? 'CLOSE' : 'RETURN',
      showPrintPDF: true,
      defaultViewMode: pages > 1 ? 'FIT_PAGE' : 'FIT_WIDTH',
    }
  )
}

@jfitz1
Copy link

jfitz1 commented Aug 31, 2023

+1

6 similar comments
@AndresCrowdComfort
Copy link

+1

@cj-c2
Copy link

cj-c2 commented Aug 31, 2023

+1

@GuillaumeCrowdcomfort
Copy link

+1

@nvillaman2023
Copy link

+1

@comark
Copy link

comark commented Sep 13, 2023

+1

@alok-xseed
Copy link

+1

@akosphp
Copy link

akosphp commented Oct 6, 2023

We're experiencing the same issue, and many of our clients have reported this problem as well. It's important to note that this problem doesn't occur on every device and browser combination. However, you can replicate it on Windows using Chrome by following these steps:

  1. Open Chrome.
  2. Navigate to the page in question.
  3. Open the developer tab in Chrome.
  4. Press F5 to refresh the page.

Please be aware that there are devices where you don't need to open the developer tab; the problem occurs during regular browsing conditions.

There are other users complaining about this issue here: https://community.adobe.com/t5/acrobat-services-api-discussions/embed-api-quot-preview-rendering-failed-quot/td-p/13947336

@comark
Copy link

comark commented Oct 6, 2023

Hello, we realized we were facing the issue sporadically on Chrome then when one of our users started previewing on Microsoft Edge it failed completely. We realized that we were using the legacy endpoint https://documentservices.adobe.com/view-sdk/viewer.js instead of https://acrobatservices.adobe.com/view-sdk/viewer.js. We changed this and it seems to work ok now. Hope it helps someone

@akosphp
Copy link

akosphp commented Oct 6, 2023

We were using this endpoint: https://documentcloud.adobe.com/view-sdk/main.js, and we switched to https://acrobatservices.adobe.com/view-sdk/viewer.js. However, we are encountering the exact same issue with both endpoints.

image_2023_10_06T10_43_49_250Z

@jeam
Copy link

jeam commented Oct 20, 2023

+1

@truongnguyenceres
Copy link

I'm facing the same issue

@truongnv98
Copy link

My issue has been resolved. I was uploading the file id as an int type instead of a string type, which caused the PREVIEW_RENDERING_FAILED error. After I cast it to String(fileId), the error no longer appeared.

@jfitz1
Copy link

jfitz1 commented Mar 13, 2024

+1

@dirkcallaway
Copy link

dirkcallaway commented May 13, 2024

+1 - This issue seems to have suddenly popped up for us as well. I've updated our URL to https://acrobatservices.adobe.com/view-sdk/viewer.js but still have the issue. Once loaded it takes ~60sec before the error occurs. This happens in Chrome & FireFox.

UPDATE - Seems the cause was that the PDFs were being rendered but not displayed within 60sec which was causing the timeout and error to throw.

@jfitz1
Copy link

jfitz1 commented May 14, 2024 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests