Serverless Framework挫折した
AWS LambdaとServerless Frameworkで爆速で作るTwitterbot https://qiita.com/gkzz/items/23a7d03aeadcec341700
Lambdaを使ってAPIを作るってのをやるために何かよい方法ないかと探してて見つけたから試してみたけど 他のnpm系ツールと同じくやっぱり依存というか複雑さというかどうしても面白くなくなっちゃうから馴染めない
今回で言うとlambdaをローカルから実行する時点で諦めた 目的が「AWS Lambdaを簡便に使えるようにして再現し易くしておきたい」だけだと これを解消する手間を今かけてから、また3か月後とかにやり直したくなって同じ手順で試せなさそう
そういう感想をもっちゃうと今やる気が削がれてしまって終わりになっちゃう Lambdaはもっと別の方法で使えるようにするけど、それにしても 公式で案内してる手順も冗長で酷いと思う
$ serverless invoke local --function rtweet Serverless: Deprecation warning: "provider.stage" is not accessible (configured behind variables which cannot be resolved at this stage). Starting with next major release, this will be communicated with a thrown error. Set "variablesResolutionMode: 20210326" in your service config, to adapt to this behavior now More Info: https://www.serverless.com/framework/docs/deprecations/#NEW_VARIABLES_RESOLVER Serverless: DOTENV: Could not find .env file. Serverless Warning -------------------------------------- A valid environment variable to satisfy the declaration 'env:REGION' could not be found. Serverless Warning -------------------------------------- A valid environment variable to satisfy the declaration 'env:STAGE' could not be found. Serverless Error ---------------------------------------- Trying to populate non string value into a string for variable ${env:REGION}. Please make sure the value of the property is a string. Get Support -------------------------------------------- Docs: docs.serverless.com Bugs: github.com/serverless/serverless/issues Issues: forum.serverless.com Your Environment Information --------------------------- Operating System: linux Node Version: 14.16.1 Framework Version: 2.39.0 Plugin Version: 4.5.3 SDK Version: 4.2.2 Components Version: 3.9.1
とりあえずaws cliは導入できたからそれは活かして公式手順でやっていくか..疲れた
AWS Lambda を AWS Command Line Interface に使用する https://docs.aws.amazon.com/ja_jp/lambda/latest/dg/gettingstarted-awscli.html