Hey, I’m running into a slight issue when trying to use RS256 encryption for my JWTs. I understand that env variables as according to AWS’s requirements cannot be longer than 4kb or 256 characters. I want to use RS256 encryption for my JWTs to make them longer and harder to crack. Unfortunately, this means a private key which is 4096 characters and a public key which is ~1000 chars, I’m looking for a way to store these in my code without uploading my .env file or having them stored openly in the repository because if someone were to get ahold of them they could become anyone on the site, admin, another user, whatever. I looked it up online and found that there was a plugin for including env variables on build called inline-functions-env, and this seemed like a great solution, so I tried to add it and I’m running into a slight issue on build.
The error is that the plugin cannot find the functions folder.
My functions are stored at the endpoint:
/.netlify/functions/server
I have this set in my .toml like such:
[[redirects]]
from = "/api/*"
to = "/.netlify/functions/server/api/:splat"
status = 200
[[redirects]]
from = "/*"
to = "/index.html"
status = 200
[functions]
directory = "/.netlify/functions/server"
[[plugins]]
package = "netlify-plugin-inline-functions-env"
[plugins.inputs]
include = ["RS256KEY", "RS256KEYPUB"]
The error is
Error: Could not list Netlify Functions files
Functions folders do not exist: /opt/build/repo/.netlify/functions-internal, /opt/build/repo/.netlify/functions/server
In "onPreBuild" event in "netlify-plugin-inline-functions-env" from netlify.toml
Why is it searching /opt/build/repo/.netlify/functions-internal
and /opt/build/repo/.netlify/functions/server
instead of just .netlify/functions/server
? I assume that is where the functions are actually stored given the endpoint, what am I doing wrong in my configuration for this to be happening?
Any and all help is very greatly appreciated, thank you in advance!