Skip to content

Can't generate PDF in localhost #24

@DavidCasillasRivero

Description

@DavidCasillasRivero

I have two environments devel and prod. Both run under https but prod is a real live web application with a valid certificate and devel is run in localhost with a self signed certificate.

Testing with prod application works as expected but devel environment always loads an empty white screen and generates an empty one page pdf. I have tried with --ignore-certificate-error flag but the result is the same. Loading the URL in the browser works fine.

The cookie used is extracted from the browser after a succesful login using the same method in both prod and devel environments.

Here is the invocation command I use and debug information:

electroshot https://localhost/#/reports/individuals/2153119b-3b9d-4d62-9b8d-a742737c178c/current 1024 --filename "tmp/electroshot.pdf" --pdf-background --format pdf --pdf-page-size A4 --debug --delay 5000 --ignore-certificate-errors --cookie sessionData=%7B%22username%22%3A%22admin%40local0.com%22%2C%22connection%22%3A%22DB-local%22%2C%22role%22%3A3%2C%22token%22%3A%22eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJlbWFpbCI6ImFkbWluQGxvY2FsMC5jb20iLCJlbWFpbF92ZXJpZmllZCI6dHJ1ZSwiYXBwX21ldGFkYXRhIjp7ImlkIjoiNzgzNTYzZjItMGNkMC0xMWU4LWJjM2QtZjQ0ZDMwYTRlMzhkIiwidXNlcm5hbWUiOiJhZG1pbkBsb2NhbDAuY29tIiwiY3VzdG9tZXIiOiJ0aF9sb2NhbDAifSwiaXNzIjoiaHR0cHM6Ly90aGVybW9odW1hbi5ldS5hdXRoMC5jb20vIiwic3ViIjoiYXV0aDB8NWE3YzRhYTY1NzM4MDIxOTQ2ZjA4MDkzIiwiYXVkIjoiMTZqMzZMVWJJNWJOUnFQOHJDb2JxeW1Sd25jU2pTZUwiLCJpYXQiOjE1MTg1OTk4NTYsImV4cCI6MTUxODYzNTg1Nn0.I05cQbqlTx0nza2KS9u87TcdAVRaGv8ZSXZykXvNDwY%22%7D       

electron debug Setting Chrome flag: pdf-page-size A4
electron debug Setting Chrome flag: ignore-certificate-errors true
electron debug Setting Chrome flag: config /tmp/electroshot-config.json
electron debug { url: 'https://localhost/#/reports/individuals/2153119b-3b9d-4d62-9b8d-a742737c178c/current',
  delay: 5000,
  selector: '',
  'zoom-factor': 1,
  format: 'pdf',
  quality: 75,
  'user-agent': '',
  latency: null,
  download: null,
  upload: null,
  css: '',
  js: '',
  debug: true,
  root: '',
  pdf: 
   { pageSize: 'A4',
     marginsType: 0,
     printBackground: true,
     landscape: false },
  cookies: 
   [ { url: 'http://localhost/',
       name: 'sessionData',
       value: '%7B%22username%22%3A%22admin%40local0.com%22%2C%22connection%22%3A%22DB-local%22%2C%22role%22%3A3%2C%22token%22%3A%22eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJlbWFpbCI6ImFkbWluQGxvY2FsMC5jb20iLCJlbWFpbF92ZXJpZmllZCI6dHJ1ZSwiYXBwX21ldGFkYXRhIjp7ImlkIjoiNzgzNTYzZjItMGNkMC0xMWU4LWJjM2QtZjQ0ZDMwYTRlMzhkIiwidXNlcm5hbWUiOiJhZG1pbkBsb2NhbDAuY29tIiwiY3VzdG9tZXIiOiJ0aF9sb2NhbDAifSwiaXNzIjoiaHR0cHM6Ly90aGVybW9odW1hbi5ldS5hdXRoMC5jb20vIiwic3ViIjoiYXV0aDB8NWE3YzRhYTY1NzM4MDIxOTQ2ZjA4MDkzIiwiYXVkIjoiMTZqMzZMVWJJNWJOUnFQOHJDb2JxeW1Sd25jU2pTZUwiLCJpYXQiOjE1MTg1OTk4NTYsImV4cCI6MTUxODYzNTg1Nn0.I05cQbqlTx0nza2KS9u87TcdAVRaGv8ZSXZykXvNDwY%22%7D',
       path: '/',
       secure: false,
       session: false } ],
  size: { width: 1024, height: 0 },
  out: '/home/azureuser/tmp/electroshot.pdf' }
electron debug Set cookie { url: 'http://localhost/',
  name: 'sessionData',
  value: '%7B%22username%22%3A%22admin%40local0.com%22%2C%22connection%22%3A%22DB-local%22%2C%22role%22%3A3%2C%22token%22%3A%22eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJlbWFpbCI6ImFkbWluQGxvY2FsMC5jb20iLCJlbWFpbF92ZXJpZmllZCI6dHJ1ZSwiYXBwX21ldGFkYXRhIjp7ImlkIjoiNzgzNTYzZjItMGNkMC0xMWU4LWJjM2QtZjQ0ZDMwYTRlMzhkIiwidXNlcm5hbWUiOiJhZG1pbkBsb2NhbDAuY29tIiwiY3VzdG9tZXIiOiJ0aF9sb2NhbDAifSwiaXNzIjoiaHR0cHM6Ly90aGVybW9odW1hbi5ldS5hdXRoMC5jb20vIiwic3ViIjoiYXV0aDB8NWE3YzRhYTY1NzM4MDIxOTQ2ZjA4MDkzIiwiYXVkIjoiMTZqMzZMVWJJNWJOUnFQOHJDb2JxeW1Sd25jU2pTZUwiLCJpYXQiOjE1MTg1OTk4NTYsImV4cCI6MTUxODYzNTg1Nn0.I05cQbqlTx0nza2KS9u87TcdAVRaGv8ZSXZykXvNDwY%22%7D',
  path: '/',
  secure: false,
  session: false }
Writing PDF /home/azureuser/tmp/electroshot.pdf
✔ Generated 1 screenshot.

Is there any way to further debug the issue to provide additional information?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions