Comments (11)
The reason is to reduce size – but I don't think it does what you think it does.
Near I can tell, GitPython (which truffleHog uses) just requires the git binary: https://github.com/gitpython-developers/GitPython#requirements – which this layer has.
Give it a shot!
from git-lambda-layer.
Going to close this – if you actually get an error trying to call git from Python, feel free to post it here
from git-lambda-layer.
Hi @mhart sorry I'm new to Layers, trying to understand how they work still!
Tried using the layer earlier, and without it, it runs - just failing at the part where it tries to use git. When I add the layer all I get is "Unable to import module 'handler'".
No idea how to troubleshoot it, if I remove the layer it runs 🤷♂️. Does the handler need to change when using a Layer?
from git-lambda-layer.
Nope, shouldn't need to change at all. Might be that some sort of error is happening during the import process?
You could try using docker-lambda to replicate the error locally to help with debugging it.
Otherwise, sounds like you might just need to triage a little more.
from git-lambda-layer.
Also, if you post a small reproduction, I can try to triage myself and see what's up
from git-lambda-layer.
There isn't much to it right now, still just trying to get the basics working before developing it.
GitHub sends details of a commit to API Gateway, which goes to my Lambda and runs this:
import json
from truffleHog import truffleHog
def handler(event, context):
try:
print("EVENT:")
print(event)
print("CONTEXT:")
print(context)
print("BODY:")
print(event['body'])
githubData = json.loads(event['body'])
print("COMMIT:")
print(githubData['before'])
print("URL:")
print(githubData['repository']['url'])
print("truffleHog:")
print(truffleHog.find_strings(githubData['repository']['url'], do_regex=True, do_entropy=True, max_depth=100000, since_commit=githubData['before'], printJson=True, surpress_output=False))
#print(truffleHog.find_strings(githubData['repository']['url'], do_regex=True, do_entropy=True, max_depth=100000))
response = {
"statusCode": 200,
"body": "test",
}
return(response)
except Exception as error:
traceback.print_exc()
I'll keep trying to learn how Layers work to see if I can figure it out myself, but only started looking at them for the first time this morning. Could be something obvious that I've missed but just seems strange that it does work without the layer.
from git-lambda-layer.
I get:
{
"errorType": "NameError",
"errorMessage": "name 'traceback' is not defined",
"stackTrace": [
" File \"/var/task/handler.py\", line 26, in handler\n traceback.print_exc()\n"
]
}
from git-lambda-layer.
If I import traceback
it seems to import fine
from git-lambda-layer.
Hmm ok, must be something wrong with my setup then! I'll try deleting and redeploying the Lambda and dependencies when I'm back on my work laptop tomorrow.
Apologies! Thanks for your help.
from git-lambda-layer.
No probs – to clarify, I got it running fine under docker-lambda
– which is a pretty good proxy of the live Lambda environment. But there's still a chance that there's some permission or something on Lambda that might get in the way. I wouldn't have expected it to crash at the import stage though.
from git-lambda-layer.
Thanks, just thought I'd confirm - it does work with Python.
Redeployed a fresh version of my Lambda and it worked!
from git-lambda-layer.
Related Issues (20)
- Nodejs12 doesn't seem to be working with layer v3? HOT 2
- Lambda nodejs12.x - Permission denied (Public Key) HOT 2
- Could you add the build process? HOT 3
- File too short on shared library libpcre2-8.so.0 HOT 6
- Add support for git lfs HOT 4
- Cannot load PCRE HOT 6
- AccessDeniedException on Gov Cloud? HOT 4
- Python import git module error for AWS Lambda HOT 1
- Lambda -> Git SSH Authentication HOT 13
- Could not deploy because lambda with layer exceeded 250 mb... HOT 3
- How to use "git push" ? HOT 7
- Support for GIT v2.30.2 because of Security Vulnerability HOT 3
- [Question] Uploading my own zip file HOT 5
- Support for using layer.zip with AWS Lambda containers HOT 7
- Support for using aws cli executable
- clone with ssh protocol hit issues
- Support for arm64 lambdas HOT 3
- How can I create my own layer? HOT 4
- using layer with python in Lambda function HOT 2
- Update to latest versions
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from git-lambda-layer.