In this video we are going to learn a lambda function errors in Node.js example.
Then our function could raise an error.
Lambda generates a JSON representation of the error.
This arrow documents appears in the invocation logs.
And for synchronous invocation, we can also see this error in the output and Amazon cloud logs.
In this video we will see how to view lambda function invocation errors for the Node.js runtime using
Lambda Console and SLI.
So let's get started.
Please open the visitor code and see that we have created a Neve lecture folder and we will follow these
steps.
But we have done in the last videos we will develop our lambda function.
If you scroll down the command text file, you can see that we have only a true exception statement
if you go to index JS file, so we will update our my function to the lambda function with this code
only throwing an exception to see how we can throw an exception and see this exception on the cloud
watch logs.
I would like to update this 100 method throwing an exception.
So this is an example of how we can throwing an example.
So if you continue the second step, command takes the file, we will zip the function code as you remember
that I'm going to zip indexes and this is creating function zip.
And in the third step we will update our code with the.
Latest one.
So this will be the updated R lambda code and the last step is create an adjacent file.
This is similar with the keyword you create and after that I'm going to invoke our updated lambda function.
Copy, paste these commands and hit enter.
So this time we will see the exception as you can see that the search scored 200.
So that means that the invocation performed successfully, but function got error.
So to see function error, you can check the response to JSON.
And in the response of JSON, you can see the detail exception in the error message and trace looks
in here.
So we can also check these logs from the Amazon cloud, which looks if you open the dashboard, you
go to the my function tree and go to the monitor and be in the cloud, which logs.
We will see the exception logs in the latest log stream that you can find in here.
There is an error log and this is the invocation error and it stays in here, error type, error message
and stick.
So for that reason we can cover our lambda functions.
We try case blocks, but we understand that how we can log and throw exception in the lambda examples.
As you can see that we have seen a number of function errors in Node.js example.