BUILDING SCALABLE AND DEPENDABLE JAMUND FERGUSON …€¦ · node.js applications building scalable...

82
NODE.JS APPLICATIONS BUILDING SCALABLE AND DEPENDABLE JAMUND FERGUSON

Transcript of BUILDING SCALABLE AND DEPENDABLE JAMUND FERGUSON …€¦ · node.js applications building scalable...

Page 1: BUILDING SCALABLE AND DEPENDABLE JAMUND FERGUSON …€¦ · node.js applications building scalable and dependable jamund ferguson. the mystery of the ! ... debugging node.js apps

NODE.JS APPLICATIONSBUILDING SCALABLE AND DEPENDABLE JAMUND FERGUSON

Page 2: BUILDING SCALABLE AND DEPENDABLE JAMUND FERGUSON …€¦ · node.js applications building scalable and dependable jamund ferguson. the mystery of the ! ... debugging node.js apps

The Mystery of the Missing Stack Trace🕵

Page 3: BUILDING SCALABLE AND DEPENDABLE JAMUND FERGUSON …€¦ · node.js applications building scalable and dependable jamund ferguson. the mystery of the ! ... debugging node.js apps

THE MYSTERY OF THE MISSING STACK TRACE

Error: Can't set headers after they are sent.    at ServerResponse.OutgoingMessage.setHeader (_http_outgoing.js:356:11)    at ServerResponse.header (/web/mynodeapp/node_modules/express/lib/response.js:767:10)    at ServerResponse.send (/web/mynodeapp/node_modules/express/lib/response.js:170:12)    at ServerResponse.res.send (/web/mynodeapp/node_modules/pplogger/index.js:225:18)    at done (/web/mynodeapp/node_modules/express/lib/response.js:1004:10)    at Stub.callback (/web/mynodeapp/node_modules/adaro/lib/engine.js:137:22)    at Stub.flush (/web/mynodeapp/pp/node_modules/dustjs-linkedin/lib/dust.js:513:10)    at Chunk.end (/web/mynodeapp/node_modules/dustjs-linkedin/lib/dust.js:612:15)    at /web/mynodeapp/node_modules/adaro/lib/patch/index.js:89:53    at /web/mynodeapp/node_modules/adaro/lib/reader/js.js:39:13    at /web/mynodeapp/node_modules/engine-munger/lib/munger.js:85:13    at /web/mynodeapp/node_modules/engine-munger/lib/cache.js:65:13    at /web/mynodeapp/node_modules/graceful-fs/graceful-fs.js:78:16    at /web/mynodeapp/node_modules/async-listener/glue.js:188:31    at FSReqWrap.readFileAfterClose [as oncomplete] (fs.js:380:3)

Page 4: BUILDING SCALABLE AND DEPENDABLE JAMUND FERGUSON …€¦ · node.js applications building scalable and dependable jamund ferguson. the mystery of the ! ... debugging node.js apps

😢

Page 5: BUILDING SCALABLE AND DEPENDABLE JAMUND FERGUSON …€¦ · node.js applications building scalable and dependable jamund ferguson. the mystery of the ! ... debugging node.js apps

We had no idea why or where our apps were failing

Page 6: BUILDING SCALABLE AND DEPENDABLE JAMUND FERGUSON …€¦ · node.js applications building scalable and dependable jamund ferguson. the mystery of the ! ... debugging node.js apps

WHAT CAN WE DO?

▸ Compare a diff between last known working code

▸ Look through other logs for more information (nginx logs, access logs, etc)

▸ Look at system metrics (is there a memory leak or CPU spike?)

▸ Add console.log statements somewhere???

▸ Advanced debugging techniques (post-mortem debugging, heapdumps, etc.)

THE MYSTERY OF THE MISSING STACK TRACE

Page 7: BUILDING SCALABLE AND DEPENDABLE JAMUND FERGUSON …€¦ · node.js applications building scalable and dependable jamund ferguson. the mystery of the ! ... debugging node.js apps
Page 8: BUILDING SCALABLE AND DEPENDABLE JAMUND FERGUSON …€¦ · node.js applications building scalable and dependable jamund ferguson. the mystery of the ! ... debugging node.js apps
Page 9: BUILDING SCALABLE AND DEPENDABLE JAMUND FERGUSON …€¦ · node.js applications building scalable and dependable jamund ferguson. the mystery of the ! ... debugging node.js apps

DECRYPT RETURNS A PROMISE

ADDUSER EXPECTS A STRING

LOG EXPECTS A SMALL OBJECT OR A STRING

Page 10: BUILDING SCALABLE AND DEPENDABLE JAMUND FERGUSON …€¦ · node.js applications building scalable and dependable jamund ferguson. the mystery of the ! ... debugging node.js apps

💣

Page 11: BUILDING SCALABLE AND DEPENDABLE JAMUND FERGUSON …€¦ · node.js applications building scalable and dependable jamund ferguson. the mystery of the ! ... debugging node.js apps

THE MYSTERY OF THE MISSING STACK TRACE

LESSONS LEARNED

▸ We need better static analysis

▸ We need better debugging tools

▸ We need a consistent way to handle errors

▸ We need to better understand our logging & monitoring💣

Page 12: BUILDING SCALABLE AND DEPENDABLE JAMUND FERGUSON …€¦ · node.js applications building scalable and dependable jamund ferguson. the mystery of the ! ... debugging node.js apps

FLOWTYPE & ESLINTSTATIC ANALYSIS WITH

Page 13: BUILDING SCALABLE AND DEPENDABLE JAMUND FERGUSON …€¦ · node.js applications building scalable and dependable jamund ferguson. the mystery of the ! ... debugging node.js apps

TYPE CHECKING COULD HAVE CAUGHT THAT BUG WITH 2-LINES OF CODE

STATIC ANALYSIS

Page 14: BUILDING SCALABLE AND DEPENDABLE JAMUND FERGUSON …€¦ · node.js applications building scalable and dependable jamund ferguson. the mystery of the ! ... debugging node.js apps

STATIC ANALYSIS

PREVENTING BUGS WITH TYPES

Page 15: BUILDING SCALABLE AND DEPENDABLE JAMUND FERGUSON …€¦ · node.js applications building scalable and dependable jamund ferguson. the mystery of the ! ... debugging node.js apps

STATIC ANALYSIS

PREVENTING BUGS WITH TYPES

Page 16: BUILDING SCALABLE AND DEPENDABLE JAMUND FERGUSON …€¦ · node.js applications building scalable and dependable jamund ferguson. the mystery of the ! ... debugging node.js apps

STATIC ANALYSIS

FLOW WON’T LET THAT SLIDE

Page 17: BUILDING SCALABLE AND DEPENDABLE JAMUND FERGUSON …€¦ · node.js applications building scalable and dependable jamund ferguson. the mystery of the ! ... debugging node.js apps

STATIC ANALYSIS

WHY ADD TYPES TO YOUR JS?

▸ Prevents large % of bugs

▸ Helps surface architectural problems

▸ Both Flow and TypeScript are well maintained, high quality tools

▸ Both syntaxes are light-weight and easy to use

▸ Both allow for gradual adoption

Page 18: BUILDING SCALABLE AND DEPENDABLE JAMUND FERGUSON …€¦ · node.js applications building scalable and dependable jamund ferguson. the mystery of the ! ... debugging node.js apps
Page 19: BUILDING SCALABLE AND DEPENDABLE JAMUND FERGUSON …€¦ · node.js applications building scalable and dependable jamund ferguson. the mystery of the ! ... debugging node.js apps

🙋 🍩🚫

Page 20: BUILDING SCALABLE AND DEPENDABLE JAMUND FERGUSON …€¦ · node.js applications building scalable and dependable jamund ferguson. the mystery of the ! ... debugging node.js apps

Type systems have a lot in common with linters

Page 21: BUILDING SCALABLE AND DEPENDABLE JAMUND FERGUSON …€¦ · node.js applications building scalable and dependable jamund ferguson. the mystery of the ! ... debugging node.js apps

Each JS File Parser (Acorn) Abstract Syntax Tree (AST) Rules

Warning

Success

Errors

Architecture of JavaScript Linter (ESLint)

Page 22: BUILDING SCALABLE AND DEPENDABLE JAMUND FERGUSON …€¦ · node.js applications building scalable and dependable jamund ferguson. the mystery of the ! ... debugging node.js apps

Linters can only think about one file at a time

Page 23: BUILDING SCALABLE AND DEPENDABLE JAMUND FERGUSON …€¦ · node.js applications building scalable and dependable jamund ferguson. the mystery of the ! ... debugging node.js apps

All Your JS FilesFlow Types & Relationships Graph

Architecture of JavaScript Type System (Flow)

Single JS File

Warning

Success

Errors

Flow

Graph

Page 24: BUILDING SCALABLE AND DEPENDABLE JAMUND FERGUSON …€¦ · node.js applications building scalable and dependable jamund ferguson. the mystery of the ! ... debugging node.js apps

COULD A LINTER HAVE HELPED US WITH OUR MYSTERY BUG?

Page 25: BUILDING SCALABLE AND DEPENDABLE JAMUND FERGUSON …€¦ · node.js applications building scalable and dependable jamund ferguson. the mystery of the ! ... debugging node.js apps

STATIC ANALYSIS

Page 26: BUILDING SCALABLE AND DEPENDABLE JAMUND FERGUSON …€¦ · node.js applications building scalable and dependable jamund ferguson. the mystery of the ! ... debugging node.js apps

STATIC ANALYSIS

Page 27: BUILDING SCALABLE AND DEPENDABLE JAMUND FERGUSON …€¦ · node.js applications building scalable and dependable jamund ferguson. the mystery of the ! ... debugging node.js apps

STATIC ANALYSIS

STATIC ANALYZERS AND FORMATTERS ARE PRETTY COOL

FlowType ESLint Prettier

Page 28: BUILDING SCALABLE AND DEPENDABLE JAMUND FERGUSON …€¦ · node.js applications building scalable and dependable jamund ferguson. the mystery of the ! ... debugging node.js apps

Unfortunately, we still get bugs from time to time

Page 29: BUILDING SCALABLE AND DEPENDABLE JAMUND FERGUSON …€¦ · node.js applications building scalable and dependable jamund ferguson. the mystery of the ! ... debugging node.js apps

INSPECTOR MODULEDEBUGGING USING THE

Page 30: BUILDING SCALABLE AND DEPENDABLE JAMUND FERGUSON …€¦ · node.js applications building scalable and dependable jamund ferguson. the mystery of the ! ... debugging node.js apps

THE BUILT-IN INSPECTOR MODULE

Page 31: BUILDING SCALABLE AND DEPENDABLE JAMUND FERGUSON …€¦ · node.js applications building scalable and dependable jamund ferguson. the mystery of the ! ... debugging node.js apps
Page 32: BUILDING SCALABLE AND DEPENDABLE JAMUND FERGUSON …€¦ · node.js applications building scalable and dependable jamund ferguson. the mystery of the ! ... debugging node.js apps

THE BUILT-IN INSPECTOR MODULE

SETTING UP A DEBUG MODE

TURN IT ON

TURN IT OFF

Page 33: BUILDING SCALABLE AND DEPENDABLE JAMUND FERGUSON …€¦ · node.js applications building scalable and dependable jamund ferguson. the mystery of the ! ... debugging node.js apps

THE BUILT-IN INSPECTOR MODULE

Page 34: BUILDING SCALABLE AND DEPENDABLE JAMUND FERGUSON …€¦ · node.js applications building scalable and dependable jamund ferguson. the mystery of the ! ... debugging node.js apps

THE BUILT-IN INSPECTOR MODULE

Set Breakpoint

Page 35: BUILDING SCALABLE AND DEPENDABLE JAMUND FERGUSON …€¦ · node.js applications building scalable and dependable jamund ferguson. the mystery of the ! ... debugging node.js apps

THE BUILT-IN INSPECTOR MODULE

PAUSE ON UNCAUGHT EXCEPTIONS

Page 36: BUILDING SCALABLE AND DEPENDABLE JAMUND FERGUSON …€¦ · node.js applications building scalable and dependable jamund ferguson. the mystery of the ! ... debugging node.js apps

THE BUILT-IN INSPECTOR MODULE

PAUSE ON CAUGHT EXCEPTIONS

Page 37: BUILDING SCALABLE AND DEPENDABLE JAMUND FERGUSON …€¦ · node.js applications building scalable and dependable jamund ferguson. the mystery of the ! ... debugging node.js apps

THE BUILT-IN INSPECTOR MODULE

Page 38: BUILDING SCALABLE AND DEPENDABLE JAMUND FERGUSON …€¦ · node.js applications building scalable and dependable jamund ferguson. the mystery of the ! ... debugging node.js apps

THE BUILT-IN INSPECTOR MODULE

Page 39: BUILDING SCALABLE AND DEPENDABLE JAMUND FERGUSON …€¦ · node.js applications building scalable and dependable jamund ferguson. the mystery of the ! ... debugging node.js apps

THE BUILT-IN INSPECTOR MODULE

Page 40: BUILDING SCALABLE AND DEPENDABLE JAMUND FERGUSON …€¦ · node.js applications building scalable and dependable jamund ferguson. the mystery of the ! ... debugging node.js apps

THE BUILT-IN INSPECTOR MODULE

Page 41: BUILDING SCALABLE AND DEPENDABLE JAMUND FERGUSON …€¦ · node.js applications building scalable and dependable jamund ferguson. the mystery of the ! ... debugging node.js apps

Don’t try this in production

STOP

Page 42: BUILDING SCALABLE AND DEPENDABLE JAMUND FERGUSON …€¦ · node.js applications building scalable and dependable jamund ferguson. the mystery of the ! ... debugging node.js apps

THE BUILT-IN INSPECTOR MODULE

Page 43: BUILDING SCALABLE AND DEPENDABLE JAMUND FERGUSON …€¦ · node.js applications building scalable and dependable jamund ferguson. the mystery of the ! ... debugging node.js apps

THE BUILT-IN INSPECTOR MODULE

Page 44: BUILDING SCALABLE AND DEPENDABLE JAMUND FERGUSON …€¦ · node.js applications building scalable and dependable jamund ferguson. the mystery of the ! ... debugging node.js apps

THE BUILT-IN INSPECTOR MODULE

https://chromedevtools.github.io/devtools-protocol/

Page 45: BUILDING SCALABLE AND DEPENDABLE JAMUND FERGUSON …€¦ · node.js applications building scalable and dependable jamund ferguson. the mystery of the ! ... debugging node.js apps

THE BUILT-IN INSPECTOR MODULE

Default Node Error

Inspector Based Error

Page 46: BUILDING SCALABLE AND DEPENDABLE JAMUND FERGUSON …€¦ · node.js applications building scalable and dependable jamund ferguson. the mystery of the ! ... debugging node.js apps

DEBUGGING NODE.JS APPS

FIND A DEBUGGING APPROACH THAT WORKS FOR YOU AND YOUR TEAM

Page 47: BUILDING SCALABLE AND DEPENDABLE JAMUND FERGUSON …€¦ · node.js applications building scalable and dependable jamund ferguson. the mystery of the ! ... debugging node.js apps

ASYNC/AWAITERROR HANDLING USING

Page 48: BUILDING SCALABLE AND DEPENDABLE JAMUND FERGUSON …€¦ · node.js applications building scalable and dependable jamund ferguson. the mystery of the ! ... debugging node.js apps

ERROR HANDLING WITH ASYNC/AWAIT

Page 49: BUILDING SCALABLE AND DEPENDABLE JAMUND FERGUSON …€¦ · node.js applications building scalable and dependable jamund ferguson. the mystery of the ! ... debugging node.js apps

Errors thrown inside async functions get converted into rejected Promises 💡

Page 50: BUILDING SCALABLE AND DEPENDABLE JAMUND FERGUSON …€¦ · node.js applications building scalable and dependable jamund ferguson. the mystery of the ! ... debugging node.js apps

ERROR HANDLING WITH ASYNC/AWAIT

Page 51: BUILDING SCALABLE AND DEPENDABLE JAMUND FERGUSON …€¦ · node.js applications building scalable and dependable jamund ferguson. the mystery of the ! ... debugging node.js apps

Async Middleware Pattern

Page 52: BUILDING SCALABLE AND DEPENDABLE JAMUND FERGUSON …€¦ · node.js applications building scalable and dependable jamund ferguson. the mystery of the ! ... debugging node.js apps

ERROR HANDLING WITH ASYNC/AWAIT

T H I S I S P R E T T Y N I C E

Page 53: BUILDING SCALABLE AND DEPENDABLE JAMUND FERGUSON …€¦ · node.js applications building scalable and dependable jamund ferguson. the mystery of the ! ... debugging node.js apps

ERROR HANDLING WITH ASYNC/AWAIT

B U T W E D O N ’ T A C T U A L LY C AT C H I T 💣

E R R O R S W I L L B U B B L E U P

Page 54: BUILDING SCALABLE AND DEPENDABLE JAMUND FERGUSON …€¦ · node.js applications building scalable and dependable jamund ferguson. the mystery of the ! ... debugging node.js apps

ERROR HANDLING WITH ASYNC/AWAIT

💥

Page 55: BUILDING SCALABLE AND DEPENDABLE JAMUND FERGUSON …€¦ · node.js applications building scalable and dependable jamund ferguson. the mystery of the ! ... debugging node.js apps

ERROR HANDLING WITH ASYNC/AWAIT

PASS IN YOUR ASYNC MIDDLEWARERETURN A STANDARD MIDDLEWARE FUNCTION

CATCH ANY ERRORS

PASS THOSE TO THE EXPRESS ERROR HANDLER

EXECUTE THE ASYNC MIDDLEWARE

APPLY AS NEEDED

Page 56: BUILDING SCALABLE AND DEPENDABLE JAMUND FERGUSON …€¦ · node.js applications building scalable and dependable jamund ferguson. the mystery of the ! ... debugging node.js apps

ERROR HANDLING WITH ASYNC/AWAIT

💥

Page 57: BUILDING SCALABLE AND DEPENDABLE JAMUND FERGUSON …€¦ · node.js applications building scalable and dependable jamund ferguson. the mystery of the ! ... debugging node.js apps

Make it easy for your engineersto do the right thing

Page 58: BUILDING SCALABLE AND DEPENDABLE JAMUND FERGUSON …€¦ · node.js applications building scalable and dependable jamund ferguson. the mystery of the ! ... debugging node.js apps

ERROR HANDLING WITH ASYNC/AWAIT

Page 59: BUILDING SCALABLE AND DEPENDABLE JAMUND FERGUSON …€¦ · node.js applications building scalable and dependable jamund ferguson. the mystery of the ! ... debugging node.js apps

Custom Error Classes

Page 60: BUILDING SCALABLE AND DEPENDABLE JAMUND FERGUSON …€¦ · node.js applications building scalable and dependable jamund ferguson. the mystery of the ! ... debugging node.js apps

CUSTOM ERRORS

Page 61: BUILDING SCALABLE AND DEPENDABLE JAMUND FERGUSON …€¦ · node.js applications building scalable and dependable jamund ferguson. the mystery of the ! ... debugging node.js apps

CUSTOM ERRORS

Page 62: BUILDING SCALABLE AND DEPENDABLE JAMUND FERGUSON …€¦ · node.js applications building scalable and dependable jamund ferguson. the mystery of the ! ... debugging node.js apps

CUSTOM ERRORS

1.

2.

3.

Page 63: BUILDING SCALABLE AND DEPENDABLE JAMUND FERGUSON …€¦ · node.js applications building scalable and dependable jamund ferguson. the mystery of the ! ... debugging node.js apps

CUSTOM ERRORS

Page 64: BUILDING SCALABLE AND DEPENDABLE JAMUND FERGUSON …€¦ · node.js applications building scalable and dependable jamund ferguson. the mystery of the ! ... debugging node.js apps

CUSTOM ERRORS

Page 65: BUILDING SCALABLE AND DEPENDABLE JAMUND FERGUSON …€¦ · node.js applications building scalable and dependable jamund ferguson. the mystery of the ! ... debugging node.js apps

CUSTOM ERRORS

Page 66: BUILDING SCALABLE AND DEPENDABLE JAMUND FERGUSON …€¦ · node.js applications building scalable and dependable jamund ferguson. the mystery of the ! ... debugging node.js apps

CUSTOM ERRORS

SUMMARY

▸ Don’t use object literals or strings for errors (missing stack trace)

▸ Use the Error built-in object

▸ Subclass Error to add statusCodes or to convert error codes into user-friendly error messages for localization, etc

▸ We basically have one error class per micro-service to handle parsing the errors out of the response….

Page 67: BUILDING SCALABLE AND DEPENDABLE JAMUND FERGUSON …€¦ · node.js applications building scalable and dependable jamund ferguson. the mystery of the ! ... debugging node.js apps

The Mystery of the Client-Side Errors)

Page 68: BUILDING SCALABLE AND DEPENDABLE JAMUND FERGUSON …€¦ · node.js applications building scalable and dependable jamund ferguson. the mystery of the ! ... debugging node.js apps

THE MYSTERY OF THE CLIENT-SIDE ERRORS

CLIENT-SIDE MONITORINGBUTTON DOESN’T WORK

REAL ISSUE USUALLY IN DEV TOOLS

Page 69: BUILDING SCALABLE AND DEPENDABLE JAMUND FERGUSON …€¦ · node.js applications building scalable and dependable jamund ferguson. the mystery of the ! ... debugging node.js apps

THE MYSTERY OF THE CLIENT-SIDE ERRORS

CLIENT-SIDE MONITORING

window.onerror = function (msg, url, line, col, error) { // 1. clean up the data // 2. log to server w/AJAX or sendBeacon() API}

Page 70: BUILDING SCALABLE AND DEPENDABLE JAMUND FERGUSON …€¦ · node.js applications building scalable and dependable jamund ferguson. the mystery of the ! ... debugging node.js apps

THE MYSTERY OF THE CLIENT-SIDE ERRORS

WE NOTICED A SPIKE DURING DEPLOY

Page 71: BUILDING SCALABLE AND DEPENDABLE JAMUND FERGUSON …€¦ · node.js applications building scalable and dependable jamund ferguson. the mystery of the ! ... debugging node.js apps

THE MYSTERY OF THE CLIENT-SIDE ERRORS

WE CONGRATULATED OURSELVES…THEN ACTUALLY LOOKED INTO THE BUG

🏆 😮

Page 72: BUILDING SCALABLE AND DEPENDABLE JAMUND FERGUSON …€¦ · node.js applications building scalable and dependable jamund ferguson. the mystery of the ! ... debugging node.js apps

THE MYSTERY OF THE CLIENT-SIDE ERRORS

Page 73: BUILDING SCALABLE AND DEPENDABLE JAMUND FERGUSON …€¦ · node.js applications building scalable and dependable jamund ferguson. the mystery of the ! ... debugging node.js apps

THE MYSTERY OF THE CLIENT-SIDE ERRORS

WE HAVE A LOT OF SERVERS

Page 74: BUILDING SCALABLE AND DEPENDABLE JAMUND FERGUSON …€¦ · node.js applications building scalable and dependable jamund ferguson. the mystery of the ! ... debugging node.js apps

THE MYSTERY OF THE CLIENT-SIDE ERRORS

WE HAVE A LOT OF SERVERS

Page 75: BUILDING SCALABLE AND DEPENDABLE JAMUND FERGUSON …€¦ · node.js applications building scalable and dependable jamund ferguson. the mystery of the ! ... debugging node.js apps

THE MYSTERY OF THE CLIENT-SIDE ERRORS

WE HAVE A LOT OF SERVERS

Page 76: BUILDING SCALABLE AND DEPENDABLE JAMUND FERGUSON …€¦ · node.js applications building scalable and dependable jamund ferguson. the mystery of the ! ... debugging node.js apps

THE MYSTERY OF THE CLIENT-SIDE ERRORS

WE HAVE A LOT OF SERVERS

Page 77: BUILDING SCALABLE AND DEPENDABLE JAMUND FERGUSON …€¦ · node.js applications building scalable and dependable jamund ferguson. the mystery of the ! ... debugging node.js apps

THE MYSTERY OF THE CLIENT-SIDE ERRORS

WE HAVE A LOT OF SERVERS

Page 78: BUILDING SCALABLE AND DEPENDABLE JAMUND FERGUSON …€¦ · node.js applications building scalable and dependable jamund ferguson. the mystery of the ! ... debugging node.js apps

THE MYSTERY OF THE CLIENT-SIDE ERRORS

UI CodeServer code

AB

Page 79: BUILDING SCALABLE AND DEPENDABLE JAMUND FERGUSON …€¦ · node.js applications building scalable and dependable jamund ferguson. the mystery of the ! ... debugging node.js apps

THE MYSTERY OF THE CLIENT-SIDE ERRORS

ROLLING BACK MADE THINGS WORSE

Page 80: BUILDING SCALABLE AND DEPENDABLE JAMUND FERGUSON …€¦ · node.js applications building scalable and dependable jamund ferguson. the mystery of the ! ... debugging node.js apps

THE MYSTERY OF THE CLIENT-SIDE ERRORS

LESSONS LEARNED

▸ UI is a huge monitoring blind-spot

▸ Be aware of how the deploy process affects users

▸ Try to make your code changes backwards compatible

▸ Consider separating UI and server deploys

Page 81: BUILDING SCALABLE AND DEPENDABLE JAMUND FERGUSON …€¦ · node.js applications building scalable and dependable jamund ferguson. the mystery of the ! ... debugging node.js apps

BUILDING SCALABLE AND DEPENDABLE NODE.JS APPLICATIONS

▸Use static analysis (including types) to catch bugs early

▸Have a plan for debugging apps in production

▸Adopt a consistent approach to error handling

▸Know how to access all of your logs

▸Don’t forget to monitor client-side errors

Page 82: BUILDING SCALABLE AND DEPENDABLE JAMUND FERGUSON …€¦ · node.js applications building scalable and dependable jamund ferguson. the mystery of the ! ... debugging node.js apps

THE END