Лямбда-функция не вызывает методы auth0 через Auth0 node-auth0 SDK - PullRequest
0 голосов
/ 06 ноября 2019

У меня есть лямбда-функция, которая запускается при добавлении сообщения в очередь SQS.

Сообщение содержит идентификатор пользователя, который я надеялся подключить к узлу Auth0 SDK .

my GetUserDetails (ниже) срабатывает, поскольку console.log можно просмотреть в CloudWatch

. В журналах 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;
  });
};

1 Ответ

0 голосов
/ 12 ноября 2019

Я получил его на работу, используя этот формат:

auth0
  .getUser(userId)
  .then(function(users) {
    console.log(users);
  })
  .catch(function(err) {
    console.log(err);
  });
...