【发布时间】:2020-03-03 10:05:16
【问题描述】:
我有一个 lambda 函数,当消息添加到 SQS 队列时会触发该函数。
该消息包含我希望连接到 Auth0 node SDK 的 userId。
console.log 在 CloudWatch 中可见时,我的 GetUserDetails(下)会触发
我可以在 Auth0 日志中看到令牌请求是通过 new ManagementClient 调用发出的,但之后就没有了。
我的代码示例
import { ManagementClient } from 'auth0';
const auth0 = new ManagementClient({
domain: 'xxx.auth0.com',
clientId: 'xxx',
clientSecret: 'xxx',
scope: 'read:users update:users',
});
const GetUserDetails = userId => {
console.log('userId', userId); <-- This fires and can be seen in CloudWatch
auth0.getUser({ id: userId }, (err, resp) => { <-- Nothing happens no errors, no user details
if (err) {
console.log('my error', err);
return err.message;
}
console.log(resp);
return resp;
});
};
【问题讨论】:
标签: javascript node.js aws-lambda auth0