#bschoeggl

1 messages · Page 1 of 1 (latest)

wind talonBOT
brazen warren
#

Hi there, can you share with me the invoice ID?

river tangle
#

in_1O2y8AJxJIrs34m7lbleId5p

brazen warren
#

Ok, this invoice is finalized so you should be able to downlaod the pdf through its invoice_pdf.

Are you able to download the pdf if you directly open the invoice_pdf link in your browser?

river tangle
#

Oh strange, it works from the browser but not curling it or hitting the url from our server

#

Any idea why that would be?

brazen warren
#

How does your server download the pdf?

river tangle
#

When I curl or hit from server, I get a 200 but a zero byte response

#

axios.get(invoice.invoice_pdf)

brazen warren
#

Are there any settings that prevent your server from downloading a file?

river tangle
#

No

#

And definitely not from just curling the link

brazen warren
#

Set responseType: 'blob' and try to downalod the file with axios again?

river tangle
#

Can you send a curl that will work?

brazen warren
#

curl https://URL_TO_DOWNLAOD should just work, but since you are using axios to download the file, you should set set responseType to blob or stream. You can find example code in axios API reference: https://axios-http.com/docs/api_intro

river tangle
#

curling directly responds with zero bytes

#

axios with responseType: 'blob' also doesn't work 😦

brazen warren
#

Can you try to perform a curl directly in your development machine?

river tangle
#

DM'd you about it

#

Got it lol

#

The pdf link stripe provides redirects to a CDN so you have to specify to axios/curl to follow the redirects