You might find AWS SAM CLI to be useful for packaging your code artifacts. I'm not sure if you've found this yet, but even so, it can be finnicky sometimes.
Particularly, the "sam build --use-container" command might be useful for simulating the Lambda environment