Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inconsistencies with TableName environment variable #658

Open
pflugs30 opened this issue Apr 1, 2022 · 0 comments
Open

Inconsistencies with TableName environment variable #658

pflugs30 opened this issue Apr 1, 2022 · 0 comments

Comments

@pflugs30
Copy link

pflugs30 commented Apr 1, 2022

I've been following the tutorial, and I've made it to the Logic Errors in Lambda Functions chapter. As I copied the first faulty code and tested it, I realized I was getting errors but not exactly as the tutorial indicated. On the next chapter, Unexpected Errors in Lambda Functions, I copied that code, too. I didn't receive the Lambda Timeout Error. Rather, I received this error:

MissingRequiredParameter: Missing required key 'TableName' in params
    at ParamValidator.fail (/var/runtime/node_modules/aws-sdk/lib/param_validator.js:50:37)
    at ParamValidator.validateStructure (/var/runtime/node_modules/aws-sdk/lib/param_validator.js:61:14)
    at ParamValidator.validateMember (/var/runtime/node_modules/aws-sdk/lib/param_validator.js:88:21)
    at ParamValidator.validate (/var/runtime/node_modules/aws-sdk/lib/param_validator.js:34:10)
    at Request.VALIDATE_PARAMETERS (/var/runtime/node_modules/aws-sdk/lib/event_listeners.js:132:42)
    at Request.callListeners (/var/runtime/node_modules/aws-sdk/lib/sequential_executor.js:106:20)
    at callNextListener (/var/runtime/node_modules/aws-sdk/lib/sequential_executor.js:96:12)
    at /var/runtime/node_modules/aws-sdk/lib/event_listeners.js:86:9
    at finish (/var/runtime/node_modules/aws-sdk/lib/config.js:396:7)
    at /var/runtime/node_modules/aws-sdk/lib/config.js:414:9 {
  code: 'MissingRequiredParameter',
  time: 2022-04-01T19:18:29.196Z
}

It took me a long time to realize what was wrong. In earlier chapters, the TableName parameter loaded its value from the process.env.TABLE_NAME environment variable. See this chapter for an example. Starting in this chapter, however, the environment variable becomes camel case (process.env.tableName). In all, there are 9 references process.env.TABLE_NAME and 51 references of process.env.tableName.

It seems logical to consolidate the references to one casing or the other. I'd be willing to make the change and submit a pull request, but I wanted to check with the team first. Thanks again for a great tutorial!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant