Error: connect ECONNREFUSED
venkadesh-p opened this issue · 1 comments
venkadesh-p commented
When i am trying to generate pdf using CLI, i am getting the following log.
$ DEBUG=pdf:* pdf-bot generate 359621c9-87cc-4070-b648-09aa51d117ba
pdf:cli Creating CLI using config file /Users/venkadesh/Downloads/pdf-bot-master/pdf-bot.config.js +0ms
pdf:generator Creating PDF for url https://esbenp.github.io with options {"completionTrigger":{"timeout":5000,"timeoutMessage":"CompletionTrigger timed out."}} +68ms
pdf:db Logging try for job ID 359621c9-87cc-4070-b648-09aa51d117ba +26s
html-pdf-chrome error: Error: connect ECONNREFUSED ::1:50296 (job ID: 359621c9-87cc-4070-b648-09aa51d117ba. Generation ID: 09864256-00a8-410f-9a7a-68a8e8ba2f05)
Anyone please help me to fix this.
xucito commented
When you run the CLI it seems that it doesn't use the chrome default port. Explicitly set it to your chrome remote debugging port (Default 9222).
var LowDB = require('./src/db/lowdb.js')
var htmlPdf = require('html-pdf-chrome')
module.exports = {
api: {
port: 3000,
token: 'api-token'
},
db: LowDB({
lowDbOptions: {},
path: 'pdf-storage/db/db'
}),
storagePath: "pdf-storage",
webhook: {
url: 'http://localhost:3000/webhooks/pdf'
},
//include this section
generator: {
// Triggers that specify when the PDF should be generated
completionTrigger: new htmlPdf.CompletionTrigger.Timer(1000), // waits for 1 sec
// The port to listen for Chrome (default: 9222)
port: 9222 //this will be your default chrome remote debugging port
}
}