如何解决503:使用 Github Probot 的 AWS Lambda 服务不可用
我正在尝试使用 probot 应用程序从 Github 接收网络钩子,但每次尝试此操作时,我都会收到 {"message":"Service Unavailable"}
错误。
Github 将此负载发送到 AWS Lambda 函数,通过谷歌搜索(我认为)这是一个没有足够节点来处理请求数量的问题。
要么是我的代码有问题,要么是配置有问题。
我正在使用无服务器框架上传到 AWS lambda。
const yamlFile = async (context) => {
try {
console.log("trying to get yaml")
var yamlfile = await context.octokit.repos.getContent({
owner: context.payload.repository.owner.login,repo: context.payload.repository.name,path: ".bit/config.yml",});
console.log(yamlfile)
} catch (e) {
console.log("Error with getting content of yaml");
console.log(e)
return null
}
console.log("got yaml,but no content yet");
yamlfile = Buffer.from(yamlfile.data.content,'base64').toString()
console.log(yamlfile)
try {
let fileContents = yamlfile
configyml = yaml.load(fileContents);
} catch (e) {
const issueBody = context.issue({
title: "[ERROR] Please read",body: `There was an issue parsing the config file of this course. Please contact your counselor and send them the below error.\n${e}`,});
context.octokit.issues.create(issueBody)
console.log("ERROR: " + e);
return null
}
console.log("returining configyml")
return configyml;
}
let currentStep = ""
let configData = await data.yamlFile(context);
console.log(configData)
if (configData == null) {
console.log("null config data");
return
}
AWS 配置
- 超时:60 秒
serverless.yml
用于无服务器框架:
service: <SERVICE NAME>
# app and org for use with dashboard.serverless.com
app: <APP NAME>
org: <ORG NAME>
frameworkVersion: "2"
useDotenv: true
provider:
name: aws
runtime: nodejs12.x
lambdaHashingVersion: 20201221
environment:
APP_ID: ${param:APP_ID}
PRIVATE_KEY: ${param:PRIVATE_KEY}
WEBHOOK_SECRET: ${param:WEBHOOK_SECRET}
NODE_ENV: production
LOG_LEVEL: debug
memorySize: 2048
functions:
webhooks:
handler: handler.webhooks
memorySize: 2048
events:
- httpApi:
path: /api/github/webhooks
method: post
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。