Hey folks - I’m attempting to deploy an application with a few lambdas. I have two users created using Netlify Identity. Both registered the same way. I am able to login and perform a call to one of my lambdas (which uses the Stripe plugin if it matters) using one of the users but cannot with the other. The one who cannot (i.e. there is an HTTP 500 error) CAN actually perform the operations they need to using ntl dev.
It appears that there is something preventing the user’s token from turning into the user object in the code. I’m using the Bearer auth header and it works for one of the users, so I am at a loss as to how to further debug this one.
No logs are showing up for this user, but the browser console does show the HTTP 500 code, so I know the function is being called. It just appears that there is some kind of auth problem that I can’t suss out.
Are there any tips or pointers on how I can dig the answers out of this haystack? With no real logs I’m at a loss as to what to provide. I will send the code though:
The calling function (in a base index.html page) looks like this:
const displayLinks = async (user) => {
fetch(’/.netlify/functions/create-manage-link’, {
method: ‘POST’,
headers: {
Authorization: Bearer ${user.token.access_token}
}})
.then((res) => res.json())
and the function that it calls looks like this:
exports.handler = async (_event, context) => {
console.log(Entering the handler for create-manage-link
);
console.log(_event data is ${JSON.stringify(_event)}
)
console.log(context data is ${JSON.stringify(context)}
); // eslint-disable-line no-console
const { app_metadata: md } = context.clientContext.user;
const strCreateResult = md.create_result;
const { stripeData } = JSON.parse(strCreateResult).data.createUser;
Here’s what the browser looks like after I call the function:
Anyone have any direction?
Thanks,
Scott