Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
LambdaのNodejsをアップデートしたら困った話
Search
is_ryo
February 12, 2020
Programming
1.5k
2
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
LambdaのNodejsをアップデートしたら困った話
is_ryo
February 12, 2020
More Decks by is_ryo
See All by is_ryo
生成AIとエンジニアの仕事と私~実践知を添えて~
is_ryo
0
130
Unknownのことをちゃんと知りたい_関西フロントエンド忘年会
[email protected]
× KINTOテクノロジーズ
is_ryo
0
51
tRPC入門
is_ryo
1
360
TypeScriptでWebAssemblyに入門しよう
is_ryo
0
400
Honoが良さそう🔥
is_ryo
1
1.5k
頑張らないオレオレVuex規約を作った話
is_ryo
4
2.9k
AppSyncで始めるGraphQL
is_ryo
1
660
Other Decks in Programming
See All in Programming
Starting & Sustaining Code-Based E2E Testing for Non-Coding QA Teams( #jasstniigata )
teyamagu
PRO
1
930
dotNET_vulnclicker_intro.pdf
deka_morita
0
110
Unity6 URPによる海底をテーマにしたVJシステムの解説 | Unity Shader 完全に理解した 勉強会
gam0022
0
340
KiroのSpecで「五目並べ」を作ってみる
satoshi256kbyte
1
360
ソニーのクラウド共通基盤の変遷とAI時代の開発スタイルに合わせた進化 / The Journey of Sony’s Common Cloud Platform and Its Evolution for AI-Native Development
kenjiyoneyama
0
240
SREの越境 / SRE Collaboration
y0hgi
2
300
mrbgem 三角測量 開発
ogom
0
210
自サークルのIdPからログアウトできるようになるまで
taiseiue
1
120
外から家のPCの電源入れたい!をPHPで解決する
kawashimo0
1
120
iOS 27でニュースアプリはどう変わる!? 〜日経電子版の新機能対応と、開発事例から〜
lynnswap
7
13k
AWSに止められる覚悟してますか?
morizo_1984
2
520
CodeRabbitの効果検証と過ごしてみた3ヶ月
armondando
0
180
Featured
See All Featured
Art, The Web, and Tiny UX
lynnandtonic
304
22k
The Curse of the Amulet
leimatthew05
3
15k
How to audit for AI Accessibility on your Front & Back End
davetheseo
0
580
JAMstack: Web Apps at Ludicrous Speed - All Things Open 2022
reverentgeek
1
620
GraphQLの誤解/rethinking-graphql
sonatard
75
12k
Reflections from 52 weeks, 52 projects
jeffersonlam
356
21k
First, design no harm
axbom
PRO
2
1.3k
[SF Ruby Conf 2025] Rails X
palkan
3
1.4k
DevOps and Value Stream Thinking: Enabling flow, efficiency and business value
helenjbeal
2
400
Building the Perfect Custom Keyboard
takai
2
900
svc-hook: hooking system calls on ARM64 by binary rewriting
retrage
2
610
Avoiding the “Bad Training, Faster” Trap in the Age of AI
tmiket
0
260
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のデプロイはフレームワーク等 で管理しないと大変…
おわり