なんでlambdaのハンドラってhelloがデフォルトなんだ

TL;DR

  • lambdaでgoの関数書くときハンドラをmainにするのを忘れるな
  • デフォルトでmainにしてくれ
  • デフォルトのハンドラがhelloになっている背景を調べたわけではない

goで書いたlambda関数のテストで早速怒られた

f:id:hagityann224:20200621102029p:plain
task/helloなんてねぇと怒られる

原因

エラーメッセージ

{
  "errorMessage": "fork/exec /var/task/hello: no such file or directory",
  "errorType": "PathError"
}

task/helloがない。 いや、helloなんて作った覚えもない

ハンドラhello(煽り)

お前か

f:id:hagityann224:20200621102709p:plain
おん・・・?

なおす

f:id:hagityann224:20200621102848p:plain
ハンドラをmainにした

なおった

f:id:hagityann224:20200621102951p:plain
とおった

さいしょからmainにしておいてくれ Node.jsはハンドラがindex.handlerなんすよね。。。なんで、、、