Serverless-plugin-optimize breaking envkey?!

aws
lambda
variables

#1

This probably has nothing to do with Envkey, but I’m at a loss and hope you guys know something.

Basically, my serverless (Lambda) function was working fine with envkey (setting an ENV var for ENVKEY in the lambda function config). Then, my lambda bundle size got too big, so I had to start using serverless-plugin-optimize in order to shrink the bundle size so that I could upload it to AWS.

It works locally, but for some reason, after switching to serverless-plugin-optimize, it says my ENVKEY is invalid:
TypeError: Cannot create property 'stack' on string 'ENVKEY invalid. Couldn't load vars.'

My ENVKEY is definitely valid as I’ve tested the same key locally and it works.

Any ideas?