Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
2

Adobe PDF Embed API Error

Community Beginner ,
Oct 12, 2023 Oct 12, 2023

We have recently tried migrating our website from Gatsby Cloud to Netlify.

 

On our site we have the Adobe PDF viewer embedded in a component which is used for all our publications and other pdf files.

 

This has been working absolutely fine for a long time.

 

Switching to Netlify hosting and pointing the dns to Netlifies servers broke the pdf viewer and it now no longer shows the PDF’s.

 

For context we had to changed our primary domain name from the apex domain as suggested by Netlify to take advantage of their Load Balancers.

 

We tried setting up a further instance of the PDF Embed service with a new API key on the www. domain but we still saw errors.

 

The normal Unauthorised error did not show and the player shows the loading spinner but once complete we just see a blank box and the following js errors in the console.

 

Console log first logs:

rendering worker created

 

TypeError: e.lastIndexOf is not a function  -   dc-core.js:2

at getNamePartsFromFullName (bootstrap.js:2:930556)

    at bootstrap.js:2:2750845

    at r.value (dc-mobx.js:2:22647)

    at Object.allowStateChanges (dc-mobx.js:2:83931)

    at dc-mobx.js:2:25072

    at Qt (dc-mobx.js:2:76193)

    at e.track (dc-mobx.js:2:78802)

    at r.l [as render] (dc-mobx.js:2:25003)

    at kj (dc-core.js:2:320948)

    at ij (dc-core.js:2:320746)

 

Uncaught (in promise) TypeError: Cannot read properties of undefined (reading ‘0’)   -    bootstrap.js:2

    at getTimingsToLogWithFirstPageLoad (bootstrap.js:2:940632)

    at bootstrap.js:2:574210

    at <anonymous>

 

A Warning 4 times:

[mobx.array] Attempt to read an array index (0) that is out of bounds (0). Please check length first. Out of bound indices will not be tracked by MobX

 

Occasioinally but not always:

 

Refused to execute inline event handler because it violates the following Content Security Policy directive: "script-src 'self' use.typekit.net assets.adobedtm.com www.adobe.com/marketingtech/ prod.adobeccstatic.com/utilnav/ widget.uservoice.com by2.uservoice.com/t2/   assets.adobe.com api.demandbase.com/api/v2/ip.json commerce.adobe.com". Either the 'unsafe-inline' keyword, a hash ('sha256-...'), or a nonce ('nonce-...') is required to enable inline execution. Note that hashes do not apply to event handlers, style attributes and javascript&colon; navigations unless the 'unsafe-hashes' keyword is present.

 

We decided to roll back the DNS to point to Gatsby Cloud while we looked into this. However rolling back to Gatsby we were still seeing the error. Even though nothing had been changed in the Gatsby set up or with the original PDF Embed credentials. So there should be no reason why this should now no longer be working.

 

This is business critical as we have many pdf’s embedded on the site. So we have currently added a fix to the live site to just download them. So you will not see the viewer on our main domain currently. However the Netlify site does have it and will become our main site as we are being forced to move to Netlify as they are closing Gatsby Cloud down which means we need a solution to fix this to work on Netlify on the www. Domain.

 

Any direction on resolving will be greatfully received.

TOPICS
PDF Embed API
1.8K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Employee ,
Oct 12, 2023 Oct 12, 2023

If you set your PDF Embed key to, let's say, something.com, then it should work on www.something.com. Can you confirm you've done that?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Oct 13, 2023 Oct 13, 2023

Hi Raymond, yes we've tried both the apex domain (which was working originally) and www. but saw the error both times.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Employee ,
Oct 13, 2023 Oct 13, 2023

You should normally just use the apex domain, foo.com, and it would then work on foo.com, www.foo.com, etc. Can you share the URL of your site so I can see?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Oct 17, 2023 Oct 17, 2023

From our devs;


Ok so the code Adobe provide as a guide had a variable in it displayTitle. This has been passed in as an object previously and been working fine however it seems something has changed and a string is what is expected. Not sure if this was something on their or our end as we have been doing various changes to rich text stuff and the graphql calls. It is now working as expected. I can also confirm after some tweaking that the apex domain does cover the sub domains so that part is also working ok.

 

Thanks for the all the replies.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Employee ,
Oct 17, 2023 Oct 17, 2023
LATEST

Not sure what you mean by displayText, I don't remember that being part of our documented API. If you can share where that _is_ documented, and if changed w/o a us issuing a release note, I can try to fix that.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources