Reading static file in function

Hey! I’m trying to use a function that sends down a PDF to authenticated users.

I’m having problems reading the static PDF file when my function is deployed. I even found this example:

I copied this example line for line (and file for file) and this guy
still prints “undefined” in the logs.


Hey @shayneo,
I’m not sure what’s missing in that example, but you may be able to try something like this:

The deployed function that sends down a pdf is here:

The main difference is that your netlify.toml would probably be less complicated :slight_smile: If you want your function to have its own dependencies aside from the root package.json, you’d do something like this:

# netlify.toml
functions = "func"
command = "cd func/send-down-pdf/ && npm install"

Let us know if that helps or if you have other questions.

1 Like