Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
LambdaのNodejsをアップデートしたら困った話
Search
is_ryo
February 12, 2020
Programming
2
1.4k
LambdaのNodejsをアップデートしたら困った話
is_ryo
February 12, 2020
Tweet
Share
More Decks by is_ryo
See All by is_ryo
生成AIとエンジニアの仕事と私~実践知を添えて~
is_ryo
0
83
Unknownのことをちゃんと知りたい_関西フロントエンド忘年会
[email protected]
× KINTOテクノロジーズ
is_ryo
0
40
tRPC入門
is_ryo
1
290
TypeScriptでWebAssemblyに入門しよう
is_ryo
0
330
Honoが良さそう🔥
is_ryo
1
1.2k
頑張らないオレオレVuex規約を作った話
is_ryo
4
2.8k
AppSyncで始めるGraphQL
is_ryo
1
630
Other Decks in Programming
See All in Programming
大規模Cloud Native環境におけるFalcoの運用
owlinux1000
0
250
GISエンジニアから見たLINKSデータ
nokonoko1203
0
190
フロントエンド開発の勘所 -複数事業を経験して見えた判断軸の違い-
heimusu
6
2.4k
疑似コードによるプロンプト記述、どのくらい正確に実行される?
kokuyouwind
0
160
生成AI時代を勝ち抜くエンジニア組織マネジメント
coconala_engineer
0
39k
Claude Codeの「Compacting Conversation」を体感50%減! CLAUDE.md + 8 Skills で挑むコンテキスト管理術
kmurahama
1
730
.NET Conf 2025 の興味のあるセッ ションを復習した / dotnet conf 2025 quick recap for backend engineer
tomohisa
0
110
HTTPプロトコル正しく理解していますか? 〜かわいい猫と共に学ぼう。ฅ^•ω•^ฅ ニャ〜
hekuchan
2
640
組み合わせ爆発にのまれない - 責務分割 x テスト
halhorn
1
180
Grafana:建立系統全知視角的捷徑
blueswen
0
280
CSC307 Lecture 03
javiergs
PRO
1
470
AgentCoreとHuman in the Loop
har1101
3
100
Featured
See All Featured
10 Git Anti Patterns You Should be Aware of
lemiorhan
PRO
659
61k
Stop Working from a Prison Cell
hatefulcrawdad
273
21k
Building Adaptive Systems
keathley
44
2.9k
Tell your own story through comics
letsgokoyo
1
780
Abbi's Birthday
coloredviolet
0
4.3k
The AI Search Optimization Roadmap by Aleyda Solis
aleyda
1
5.1k
Self-Hosted WebAssembly Runtime for Runtime-Neutral Checkpoint/Restore in Edge–Cloud Continuum
chikuwait
0
280
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
35
3.3k
svc-hook: hooking system calls on ARM64 by binary rewriting
retrage
1
50
Ethics towards AI in product and experience design
skipperchong
1
170
AI: The stuff that nobody shows you
jnunemaker
PRO
2
170
Lessons Learnt from Crawling 1000+ Websites
charlesmeaden
PRO
0
1k
Transcript
2020/02/12 関西Node学園 9時限目 Ryosuke Izumi
Ryosuke Izumi WebApplication / IoT AWS / Vue / TypeScript
/ Serverless v-kansai & kansai.ts organizer @is_ryo
今日の話題
Lambda+Node.js の小話
AWS使ってる人
AWS使えるって 言える人いますか?
Lambda使ってる人
Lambda って便利ですよね
ほんとユースケースが多い
個人的には Python とか Nodejs をLambda上で動かすことが多い
https://twitter.com/Keisuke69/status/1224630084465643520
ただEOLが近づいてくると AWSからメールが飛んでくる
AWS「Nodejs v8 はもうすぐEOL だから10か12にバージョン上げ てね。EOLになったあとも動くけ ど、Lambda自体の更新はできな くなるよ。よろしく。」
めっちゃ親切やん…
Lambda 上の Nodejs も ちゃんとメンテナンスしないと いけない…
やったこと
Nodejs8.10 → Nodejs10.x
基本的に脳死状態で アップデートしていった (真似しちゃダメ。絶対。)
あるLambdaだけアップデート したあとにエラーを吐き出した…
何が起きたか
module が見つからん! っていうエラーが出た
こんな書き方になっていた…
おわかりいただけただろうか?
None
原因
Nodejs10.x から AmazonLinux2 上に展開されるようになってい て、環境変数$NODE_PATHの内 容が変わっていた。
Lambda Workers (EC2 Instances) Host OS Hypervisor MicroVM Lambda Lambda
EC2 Bare Metal Instance Host OS Host Kernel KVM Firecraker MicroVM Lambda Firecraker MicroVM Lambda EC2 モデル Firecraker モデル
• Nodejs8.10 • Nodejs10.x
• Nodejs8.10 /opt/nodejs/node8/node_modules:/opt/nodejs /node_modules:/var/runtime/node_modules:/v ar/runtime:/var/task:/var/runtime/node_mod ules • Nodejs10.x /opt/nodejs/node10/node_modules:/opt/nodej s/node_modules:/var/runtime/node_modules
https://nodejs.org/docs/v12.13.1/api/modules.html
/var/task に path が通って なかったので参照できなかった
解決方法
ちゃんと相対パスで書こう
import文を使おう
まとめ
• require はちゃんと相対パスで書こう • import文っていう方法もあるよ • アップデートはNodejs だけの問題じゃ ないときあるので気をつけよう •
Lambdaのデプロイはフレームワーク等 で管理しないと大変…
おわり