We are deploying functions with SST that are then ...
# sst
j
We are deploying functions with SST that are then used as Cloudfront Lambda@edge functions which do not allow environment var pass to them. Is there a way to either do something similar to replaceValues in the static site but on regular function handlers or another approach where the variable can be set based on the environment?
f
Hey @Jack Fraser, yeah we’ve got some thoughts on working around the env var limitation https://github.com/serverless-stack/serverless-stack/issues/577
Solution 3 seems similar to what you are proposing, I’m also leaning towards it.
j
Sounds good. The header option has a lot of bloat for CDK etc so replace seems the best of those 3 options.
@Frank any timeline on this?
t
you can't use sst.Function as edge function right
j
@thdxr maybe. Though regular ssst.Function adds default env of
AWS_NODEJS_CONNECTION_REUSE_ENABLED
which causes issues
t
was just thinking about how bundle.esbuild.define lets you do this
j
?