jbaiter/pdiiif

Create PDF not working properly in Docker

andybuki opened this issue · 5 comments

I can start the docker container and add a manifest.
On the demo web page (https://pdiiif.jbaiter.de/), and I get a PDF back,
but on my Docker Server I have the following issue:

PDF-Erstellung fehlgeschlagen: Cannot read properties of undefined (reading 'request')

> index.ab1e0e54.js:22 Failed to render page TypeError: Cannot read properties of undefined (reading 'request')
>     at index.ab1e0e54.js:107:30836
>     at new Promise (<anonymous>)
>     at Object.write (index.ab1e0e54.js:107:30805)
>     at kw.write (index.ab1e0e54.js:27:358)
>     at Fw.write (index.ab1e0e54.js:27:182)
>     at mC._write (index.ab1e0e54.js:98:217)
>     at mC._flush (index.ab1e0e54.js:89:1306)
>     at mC.finalizePdfHeader (index.ab1e0e54.js:87:5797)
>     at mC.renderPage (index.ab1e0e54.js:87:6037)
>     at xC (index.ab1e0e54.js:106:19776)
> error @ index.ab1e0e54.js:22
> xC @ index.ab1e0e54.js:106
> await in xC (async)
> X @ index.ab1e0e54.js:107
> await in X (async)
> _ @ index.ab1e0e54.js:107
> index.ab1e0e54.js:107 TypeError: Cannot read properties of undefined (reading 'request')
>     at index.ab1e0e54.js:107:30836
>     at new Promise (<anonymous>)
>     at Object.write (index.ab1e0e54.js:107:30805)
>     at kw.write (index.ab1e0e54.js:27:358)
>     at Fw.write (index.ab1e0e54.js:27:182)
>     at mC._write (index.ab1e0e54.js:98:217)
>     at mC._flush (index.ab1e0e54.js:89:1306)
>     at mC.finalizePdfHeader (index.ab1e0e54.js:87:5797)
>     at mC.renderPage (index.ab1e0e54.js:87:6037)
>     at xC (index.ab1e0e54.js:106:19776)

When I click on PDF button on your server it opens a window where I can save my pdf file. (works correctly)
In my case it creates an empty pop-window (http://b-lx0201.sbb.spk-berlin.de:8082/streamsaver-mitm.html)

Do you have any ideas?

image

I added an image for better understanding

  • Which browser are you using (and in which version?)
  • Is this a vanilla browser or do you have any special settings, like restrictions on JavaScript APIs to use?
  • Does the problem occur across multiple browsers?
  • How are you running the app in Docker?

Also: is the site running with https or http?

I have this problem in Chrome and Firefox.
I tested https://pdiiif.jbaiter.de/ in the same Chrome, and it works correctly.
I have a standard browser without extra settings.
I run Docker with the following command:
docker run -p 8082:8080 --cap-add=SYS_ADMIN --name pdiiif pdiiif

in Dockerfile I added:

ENV http_proxy=http://proxy.sbb.spk-berlin.de:3128
ENV https_proxy=http://proxy.sbb.spk-berlin.de:3128

and changed:
#RUN wget -q -O - https://unpkg.com/@pnpm/self-installer | node
with
RUN npm install -g pnpm

Thank you, the only thing that I can imagine might make issues is the use of a proxy, can you try running it without a proxy and see if it works?
Also, if you're not running the site with https, can you try to do that and see if that helps? For example with a Let's Encrypt certificate.

I found the problem I started it directly on the server. It works there and creates the right PDF. I think the problem is browser settings. I try to start it inside the library network.
Thanks for help!!