Why the first element of response is null in serverless?

I am newbee in serverless framework, I try to read some lambda functions example. I find the interesting stuff, the handler of request always be null, for instance.

exports.handler = async function(event, context, callback) {
    ....
    callback(null, 'Success!');

}

what is the first element of the callback response meanning? If the element is not null, what it should be? why it should be null?

First, if you’re using the async handler syntax there is no callback parameter (officially). You’re supposed to return the result you want to send on success.

The first parameter to the callback function is the error if your handler fails. It’s supposed be an Error or subclass. If there is no error then you return null. If you’re using the async syntax you can just throw an error.