TynesideGroup/adonis-pdf

Cannot create a pdf file on production.

Zuczekk opened this issue · 1 comments

Cannot create a pdf file on production.

Hi
I have this problem when trying to create a pdf file on production I get the following error :

TypeError: Converting circular structure to JSON
--> starting at object with constructor 'Socket'
| property 'parser' -> object with constructor 'HTTPParser'
--- property 'socket' closes the circle

On the develop file is created normally on the same source code
When locally in the env file, I change NODE_ENV parameter to "production" and code is not anywhere changed i get this error to.
Source Code:
`async generatePdf({response, auth, request,}){

	const {status_uuid} = request.all()

	const status = await Status.query().where('uuid', status_uuid).with('investor').with('plot', builderQuery => {builderQuery.with('settlement')}).with('offer').first()
	if(!status){
		return response.status(422).send({error: 'Bad Status'})
	}
	const status_json = status.toJSON()

	const investor_name = `${status_json.investor.first_name} ${status_json.investor.last_name}`
	const investor_address = `${status_json.investor.street} ${status_json.investor.house_number} ${status_json.investor.zip_code} ${status_json.investor.zip_code}`


	const content = [
		{text: first_text( status_json.plot.settlement.name , status_json.updated_at, status_json.investor.pesel, investor_address, investor_name, status_json.plot.number, status_json.plot.name), pageBreak: 'after'},
	  	{text: second_text( status_json.plot.settlement.name , status_json.investor.pesel, investor_address, investor_name, status_json.plot.number, status_json.offer.deposit,status_json.plot.size)}
	]



	 await PDF.create(content, response.response)




	return response.header('Content-type', 'application/pdf')



	}`

unknown
corgi