I am having difficulty to execute an aws-sdk dynamodb api call within auth0 RULEs, which otherwise worked in ACTIONs and HOOKs. Since ACTIONs do not fire pre-registration, and HOOKs don’t work work for social logins, the last resort is to use RULEs.
Does anyone have experience with executing aws-sdk
dynamoDB queries from Auth0 rules? Can someone point out what am I doing wrong in the following snippet?
function(user, context, callback) {
const AWS = require('aws-sdk@2.458.0');
var db = new AWS.DynamoDB({
accessKeyId: configuration.AWS_KEY_ID,
secretAccessKey: configuration.AWS_SECRET,
region: configuration.AWS_REGION
});
const run = async () => {
try {
console.log("before call await list tables...");
const results = await db.listTables({}).promise();
console.log("we should have a result here...");
console.log(results.TableNames.join("\n"));
} catch (err) {
console.log("or some sort of error thrown:", err);
}
};
run();
return callback(null, user, context);
}
best wishes: steve