"Invalid AWS Lambda parameters. Reserved keys used in this request."

Not in this case. I’ve run into that error too. :sweat_smile: I wanted to use S3 but it’s illegal to use the AWS env variables. You have to call them MY_APP_AWS… instead of the default names.

In this case, the same env var was in use in another Netlify site, so it wasn’t an illegal name per se.

In that case, the error message is definitely misleading.

Hey @carlmjohnson,
That’s a great idea. Can you please share the deploy log where you saw that? I’ll also work on a reproduction case and then get a request filed. Many thanks for the suggestion.

5:11:22 PM: 3 new files to upload
5:11:22 PM: 2 new functions to upload
5:11:24 PM: Invalid AWS Lambda parameters. Reserved keys used in this request
5:11:24 PM: Invalid AWS Lambda parameters. Reserved keys used in this request
5:12:47 PM: Failed to upload file: identity-signup
5:13:19 PM: Failed to upload file: almanack-api
5:13:19 PM: Failing build: Failed to deploy site
5:13:19 PM: Finished processing build request in 6m15.363468051s

Awesome, thank you. Turns out there’s an existing issue filed internally on these misleading log lines- I’ve added the details in this thread so we can update you if/when there’s movement on it.

By any chance, did you get the error resolved? I have the same error: Invalid AWS Lambda parameters. Reserved keys used in this request..

we still have this issue open, but i have added your voice to the chorus. We’ll definitely update here if there are changes.

I spent a total of 6 hours debugging that error before i realize that one my cloud function file was empty… once this file deleted everything worked fine again…
this error was misleading me… i suppose it should be updated…!!

1 Like

Hey there, @romain1304 :wave:

Thanks for following up on this thread, I will add your feedback to the open issue.

Same here.

I’ve had an empty function file for quite a while now, and just today it started failing my deploy.
Thanks to romain, I knew what to look for and removed the empty file. Without his post, I probably would have spent 6 hours tearing my hair out as well :slight_smile:

Hopefully anyone who Googles the error will find this thread and know what to do. No more empty function files!

2 Likes

that is great to hear! this is the community helping each other in a way that we love :netliheart:

1 Like

There has been some suggestions in this thread around the ability to specify what environment variables are used in functions. We have a lot of environment variables we use in our frontend applications at build time and only a couple needed for the functions, we have run into the 4kb issue quite a few times and shortening the environment variable names is not something we can do sensibly anymore. Many of them are also sensitive so they cannot be set in the netlify.toml file.

Is there any update on improving the environment variable flow in functions?

2 Likes

hi there @alexjfno1 - totally hear you on this. I am asking to see if we can get some up to date news on this.

Thank @perry, did you get any more information on this, it’s becoming a real blocker for us now.

Hi @alexjfno1,

Unfortunately, there’s no update yet. The limit is imposed by AWS and not by Netlify as mentioned in their docs: Using AWS Lambda environment variables - AWS Lambda (Configuring environment variables section).

I totally understand the limit imposed by AWS and know that you can’t get around that. What I’m more interested in is the ability to control what environment variables get sent where. The ability to select what env variables are injected into the function would be great, instead of sending every variable defined in the UI.

That is an interesting feature request. Like you know, there’s no way to do that as of now.

The only workaround is the one in the thread you linked above. As to if/when the feature would be available in the future, we do not have a timeframe.

1 Like

Thanks for the update @hrishikesh

Does the 4kb limit apply to just environment variable VALUES or to the combinations of KEY/VALUE pairs?

What I mean is, if we use short environment variables names are we saving some characters that we can then use towards the 4kb limit?

Yes, the name counts too. So you can squeeze in a few characters by keeping shorter names.