1
00:00:00,300 --> 00:00:06,420
In this video, we are going to change a lambda function code on a management console.

2
00:00:06,630 --> 00:00:08,220
So let's get started.

3
00:00:08,610 --> 00:00:13,860
In order to change a function code, we should go to the function and come to the code section.

4
00:00:13,860 --> 00:00:16,260
And here you can see the code source.

5
00:00:16,500 --> 00:00:23,370
So basically this is our function, but I would like to change our code with throwing an exception.

6
00:00:23,370 --> 00:00:30,270
So for that purpose, I would like to put the first line of code as a true naive error and give the

7
00:00:30,270 --> 00:00:35,730
description is a event should existing name, which is logging the incoming event.

8
00:00:36,060 --> 00:00:42,540
So basically if we throwing an exception in the first line of code, these codes will not be work and

9
00:00:42,540 --> 00:00:44,610
throwing exception in this line of code.

10
00:00:44,760 --> 00:00:48,120
So let's try this exception code.

11
00:00:48,120 --> 00:00:53,820
And first of all, we should deploy to quote this we deploy our new codes for naive invocations.

12
00:00:53,820 --> 00:00:56,940
Otherwise these invocations will not be affected.

13
00:00:56,940 --> 00:01:05,070
So that's why we should click the deploy first and see that we have successfully updated our function

14
00:01:05,070 --> 00:01:05,610
code.

15
00:01:05,640 --> 00:01:09,300
Now it is time to test our function code.

16
00:01:10,100 --> 00:01:14,930
As you remember, that we have already created a test template, which is the test function payload.

17
00:01:14,930 --> 00:01:20,920
So for that reason I'm going to click the test button directly in this window and click the test button.

18
00:01:20,930 --> 00:01:28,010
This will send the request to our test function payload event and execute the invocation or lambda function

19
00:01:28,010 --> 00:01:31,550
and our lambda function return response in here.

20
00:01:31,910 --> 00:01:39,500
So as you can see that this is returning an error and the error message is in here eventually existing

21
00:01:39,500 --> 00:01:42,920
in a and you can see the trace and details if you scroll down.

22
00:01:42,920 --> 00:01:49,310
We can see also function logs which is already also written in the Amazon cloud, which looks and we

23
00:01:49,310 --> 00:01:52,610
see the exact same error in the logs.

24
00:01:52,610 --> 00:01:59,960
So basically lambda run our function code and the function handle receives the event and then respond

25
00:01:59,960 --> 00:02:01,850
back to function response.

26
00:02:01,850 --> 00:02:08,270
The function is throwing an exception and we see on the logs and let's also see these logs on the Amazon

27
00:02:08,270 --> 00:02:13,520
cloud logs for that purpose, click the monitor and we in cloud watch logs.

28
00:02:14,330 --> 00:02:16,160
And this time we will see the exception.

29
00:02:16,160 --> 00:02:17,330
Log into Oracle.

30
00:02:17,990 --> 00:02:22,580
Please open the latest log stream and see that in here.

31
00:02:22,610 --> 00:02:24,320
We solve the error.

32
00:02:24,320 --> 00:02:27,890
Log in here when I'm working our function.

33
00:02:27,920 --> 00:02:30,110
The details listed in here.

34
00:02:30,990 --> 00:02:37,710
So as you can see that we have changed the ADA Lambda Code and update the code, deploy the code and

35
00:02:37,710 --> 00:02:41,790
after that, test the code and see the logs, error logs on the cloud.

36
00:02:41,790 --> 00:02:42,390
Watch logs.
