1
00:00:00,360 --> 00:00:06,930
In this video we are going to learn a lambda function errors in Node.js example.

2
00:00:08,490 --> 00:00:10,860
Then our function could raise an error.

3
00:00:10,890 --> 00:00:14,130
Lambda generates a JSON representation of the error.

4
00:00:14,250 --> 00:00:17,370
This arrow documents appears in the invocation logs.

5
00:00:17,670 --> 00:00:23,880
And for synchronous invocation, we can also see this error in the output and Amazon cloud logs.

6
00:00:24,330 --> 00:00:30,690
In this video we will see how to view lambda function invocation errors for the Node.js runtime using

7
00:00:30,720 --> 00:00:32,690
Lambda Console and SLI.

8
00:00:32,880 --> 00:00:34,530
So let's get started.

9
00:00:35,390 --> 00:00:42,620
Please open the visitor code and see that we have created a Neve lecture folder and we will follow these

10
00:00:42,620 --> 00:00:43,010
steps.

11
00:00:43,010 --> 00:00:46,820
But we have done in the last videos we will develop our lambda function.

12
00:00:46,820 --> 00:00:52,640
If you scroll down the command text file, you can see that we have only a true exception statement

13
00:00:52,640 --> 00:00:59,600
if you go to index JS file, so we will update our my function to the lambda function with this code

14
00:00:59,630 --> 00:01:05,530
only throwing an exception to see how we can throw an exception and see this exception on the cloud

15
00:01:05,540 --> 00:01:06,290
watch logs.

16
00:01:06,410 --> 00:01:10,400
I would like to update this 100 method throwing an exception.

17
00:01:10,670 --> 00:01:14,570
So this is an example of how we can throwing an example.

18
00:01:14,570 --> 00:01:21,530
So if you continue the second step, command takes the file, we will zip the function code as you remember

19
00:01:21,530 --> 00:01:26,420
that I'm going to zip indexes and this is creating function zip.

20
00:01:26,420 --> 00:01:31,340
And in the third step we will update our code with the.

21
00:01:32,880 --> 00:01:33,860
Latest one.

22
00:01:33,870 --> 00:01:42,360
So this will be the updated R lambda code and the last step is create an adjacent file.

23
00:01:42,450 --> 00:01:49,110
This is similar with the keyword you create and after that I'm going to invoke our updated lambda function.

24
00:01:50,280 --> 00:01:52,980
Copy, paste these commands and hit enter.

25
00:01:53,010 --> 00:01:58,330
So this time we will see the exception as you can see that the search scored 200.

26
00:01:58,350 --> 00:02:03,780
So that means that the invocation performed successfully, but function got error.

27
00:02:03,780 --> 00:02:07,230
So to see function error, you can check the response to JSON.

28
00:02:07,230 --> 00:02:13,110
And in the response of JSON, you can see the detail exception in the error message and trace looks

29
00:02:13,110 --> 00:02:13,860
in here.

30
00:02:13,860 --> 00:02:20,310
So we can also check these logs from the Amazon cloud, which looks if you open the dashboard, you

31
00:02:20,310 --> 00:02:26,970
go to the my function tree and go to the monitor and be in the cloud, which logs.

32
00:02:27,450 --> 00:02:33,810
We will see the exception logs in the latest log stream that you can find in here.

33
00:02:33,840 --> 00:02:40,500
There is an error log and this is the invocation error and it stays in here, error type, error message

34
00:02:40,500 --> 00:02:41,190
and stick.

35
00:02:41,190 --> 00:02:44,730
So for that reason we can cover our lambda functions.

36
00:02:44,730 --> 00:02:51,360
We try case blocks, but we understand that how we can log and throw exception in the lambda examples.

37
00:02:51,360 --> 00:02:56,130
As you can see that we have seen a number of function errors in Node.js example.
