Hello I have a lamda file: identity-signup.js
which is not triggering when a user signs up and an identity is created
// identity-signup.js
const faunadb = require("faunadb");
const q = faunadb.query;
exports.handler = async function (event, context) {
const { identity, user } = context.clientContext;
console.log(`A user has signed up: ${user.meta.full_name}`);
const client = new faunadb.Client({
secret: process.env.FAUNADB_SERVER_SECRET,
});
try {
await client.query(q.Create(q.Collection("users"), { data: user }));
return {
success: true,
msg: `Success provision of user ${user.email} to FaunaDB`,
};
} catch (error) {
return {
success: false,
msg: `Error provisioning user ${user.email} to FaunaDB`,
error,
};
}
};
The logs are empty and it seems like the function never fires.
I can see my users get created in identity.
I have tested this works as a http endpoint in a different format but I would prefer on identity created trigger.
I see the file in my functions list for logs but Function Log is always loading with spinning /
luke
November 25, 2020, 10:36am
3
Hi, @DustinRobison . I tested a sign-up and I did see the function get triggered once I confirmed my email address.
However, there were errors in the function logs which I’m including below:
1:37:43 AM: 2020-11-25T09:37:43.428Z 9bd38fd3-1c99-4774-8966-f8973cfa0f7f ERROR Invoke Error {"errorType":"TypeError","errorMessage":"Cannot read property 'meta' of undefined","stack":["TypeError: Cannot read property 'meta' of undefined"," at Runtime.exports.handler (/var/task/src/lambda/identity-signup.js:6:45)"," at Runtime.handleOnce (/var/runtime/Runtime.js:66:25)"]}
1:37:43 AM: Duration: 4.83 ms Memory Usage: 70 MB Init Duration: 169.67 ms
1:37:43 AM: 2020-11-25T09:37:43.483Z 85530de8-14d4-4ace-ac9e-09b8d2e8c9e2 ERROR Invoke Error {"errorType":"TypeError","errorMessage":"Cannot read property 'meta' of undefined","stack":["TypeError: Cannot read property 'meta' of undefined"," at Runtime.exports.handler (/var/task/src/lambda/identity-signup.js:6:45)"," at Runtime.handleOnce (/var/runtime/Runtime.js:66:25)"]}
1:37:43 AM: Duration: 1.86 ms Memory Usage: 70 MB
1:37:43 AM: 2020-11-25T09:37:43.535Z a7d23c5a-8979-494a-83ad-dfd6b50e3939 ERROR Invoke Error {"errorType":"TypeError","errorMessage":"Cannot read property 'meta' of undefined","stack":["TypeError: Cannot read property 'meta' of undefined"," at Runtime.exports.handler (/var/task/src/lambda/identity-signup.js:6:45)"," at Runtime.handleOnce (/var/runtime/Runtime.js:66:25)"]}
1:37:43 AM: Duration: 1.72 ms Memory Usage: 70 MB
1:37:56 AM: 2020-11-25T09:37:56.297Z 2e237a66-f0d7-4ff0-a3f8-239cfa55e909 ERROR Invoke Error {"errorType":"TypeError","errorMessage":"Cannot read property 'meta' of undefined","stack":["TypeError: Cannot read property 'meta' of undefined"," at Runtime.exports.handler (/var/task/src/lambda/identity-signup.js:6:45)"," at Runtime.handleOnce (/var/runtime/Runtime.js:66:25)"]}
1:37:56 AM: Duration: 1.87 ms Memory Usage: 70 MB
1:37:56 AM: 2020-11-25T09:37:56.353Z 85327e3a-72bb-40e9-8095-d63cc5e516b3 ERROR Invoke Error {"errorType":"TypeError","errorMessage":"Cannot read property 'meta' of undefined","stack":["TypeError: Cannot read property 'meta' of undefined"," at Runtime.exports.handler (/var/task/src/lambda/identity-signup.js:6:45)"," at Runtime.handleOnce (/var/runtime/Runtime.js:66:25)"]}
1:37:56 AM: Duration: 1.44 ms Memory Usage: 70 MB
1:37:56 AM: 2020-11-25T09:37:56.410Z 60364c75-9562-4474-aa37-631e69dbae4a ERROR Invoke Error {"errorType":"TypeError","errorMessage":"Cannot read property 'meta' of undefined","stack":["TypeError: Cannot read property 'meta' of undefined"," at Runtime.exports.handler (/var/task/src/lambda/identity-signup.js:6:45)"," at Runtime.handleOnce (/var/runtime/Runtime.js:66:25)"]}
1:37:56 AM: Duration: 3.99 ms Memory Usage: 70 MB
The logs only persist for one hour and I didn’t want them to expire before you could read them.
If there are other questions or concerns, please let us know.
ah ha! i didn’t confirm the email address.
Thank you for your help!
I wish the docs explained it is on verification
luke
November 26, 2020, 3:56am
5
Hi, @DustinRobison . I’ll let the documentation team know you think adding this requirement to the documentation would be helpful.
Please consider prioritizing this. I ran into this back in August and it still hasn’t been added to the docs. If we can file a PR to the docs, I surely would.
luke
December 2, 2020, 2:52am
8
It’s on the todo list, @cfjedimaster .
luke
Split this topic
December 3, 2020, 1:09pm
9
A post was split to a new topic: Function question