anc95 / ChatGPT-CodeReview

🐥 A code review bot powered by ChatGPT
https://github.com/apps/cr-gpt
ISC License
3.77k stars 360 forks source link

deploy on aws lambda #131

Open yunho-ju opened 9 months ago

yunho-ju commented 9 months ago

Hello! First of all, I really like your project. I have a question: I'm currently trying to deploy it on AWS Lambda. Could you please guide me on how to do that? Thank you.

anc95 commented 9 months ago
  1. You should prepare the required env variable in the .env file
  2. yarn build:lambda to build the aws lambda function
  3. use serverless for deploying. (AWS account is required)
yunho-ju commented 9 months ago
 "errorType": "Runtime.ImportModuleError",
    "errorMessage": "Error: Cannot find module '/var/task/lambda'\nRequire stack:\n- /var/runtime/index.mjs",
    "stack": [
        "Runtime.ImportModuleError: Error: Cannot find module '/var/task/lambda'",
        "Require stack:",
        "- /var/runtime/index.mjs",
        "    at _loadUserApp (file:///var/runtime/index.mjs:1061:17)",
        "    at async UserFunction.js.module.exports.load (file:///var/runtime/index.mjs:1093:21)",
        "    at async start (file:///var/runtime/index.mjs:1256:23)",
        "    at async file:///var/runtime/index.mjs:1262:1"
    ]

after deploy i got above error at aws lambda from cloudwatch log

what did i miss?

@anc95

yunho-ju commented 9 months ago

I found.

in serverless.yml file change handler path like below

    handler: lambda/index.webhooks 
anc95 commented 9 months ago

@yunho-medi You deployed a webhook. Then you should create a github app with the webhook endpoint configured, then install the app to your repo, and event such as a pull request open / sync happened, would invoke the webhook for reviewing