maciejtreder / serverless-apigw-binary

Serverless plugin for binary files support in AWS Gateway
MIT License
160 stars 33 forks source link

PDF not working #48

Open jfaraklit opened 6 years ago

jfaraklit commented 6 years ago

When trying to get PDF, the PDF is coming blank. Tried adding 'application/pdf' in the list of mime types. Any thoughts? Html and CSS and images can be served.

pspEgg commented 5 years ago

@ajshukury a workaround (with a big side effect)

create a separate project JUST for the pdf generating endpoint, then:

adding */* to types will work for PDF.

If you have other functions in the same project: Your other functions will be affected as everything will be treated as binary.

So if you use this workaround, create a separate Serverless.yml for it (in order to create a separate API Gateway)

Something else you should know: once you publish a function with */* you cannot undo it, meaning even if you switch back to application/pdf your other normal functions will still be affected. I have also tried manually editing the API gateway binary MIME types in the AWS Console, it cannot be deleted.

JaredAAT commented 3 years ago

adding / to types will work for PDF.

If you have other functions in the same project: Your other functions will be affected as everything will be treated as binary.

it's 2021... Has anyone found a better way of doing this? adding */* to deal with serving PDF content, still massively breaks any other functions within a serveless.yml file

pspEgg commented 3 years ago

split pdf function into its own serverless project.

On Wed, May 5, 2021 at 11:01 AM JaredAAT @.***> wrote:

adding / to types will work for PDF.

If you have other functions in the same project: Your other functions will be affected as everything will be treated as binary.

it's 2021... Has anyone found a better way of doing this? adding / to deal with serving PDF content, still massively breaks any other functions within a serveless.yml file

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/maciejtreder/serverless-apigw-binary/issues/48#issuecomment-832895070, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAMM2WBAXMSCU7S3DFC6YL3TMGBW7ANCNFSM4F6O5MFQ .