Hi,
I am using netlify dev in order to test a lamba serverless function from netlify identity admin methods. In particular, I am trying to get the list of users that signed up on my website. (from here: GitHub - netlify/gotrue-js: JavaScript client library for GoTrue)
exports.handler = async (event, context) => {
const {identity, user} = context.clientContext;
const usersUrl = `${identity.url}/admin/users`;
const adminAuthHeader = 'Bearer ' + identity.token;
console.log('event', JSON.stringify(event));
console.log('context', JSON.stringify(context));
try {
const resp = await fetch(usersUrl, {
method: 'GET',
headers: {Authorization: adminAuthHeader},
})
const data = resp.json()
return data
} catch (e) {
return e;
}
};
So I defined my function file called users.js inside my functions directory where I put the above piece of code. I tried both the async/await approach and callback approach. I tried to use both fetch and axios to make the request to the netlify identity url.
And I get the following error:
Your function response must have a numerical statusCode. You gave: $ undefined
This means that for some reason the lambdaResponse is undefined, as I saw how the error is handled in this commit: ’
https://github.com/netlify/netlify-dev-plugin/pull/124/files
Could you please help me with some answers?
Thanks a lot!