Hi @kai.schwidder,
Welcome to the Community!
Just to clarify, could you talk a little bit more about what you’d like to use the pre-registration hook for?
Are you finding that the callback (cb
) being called before the response is received?
I think you may need to update the async/await code a little:
const got = require('got');
module.exports = async function (user, context, cb) {
var response = {};
response.user = user;
try {
var values = await got('https://apidev.coshare.ch/api/config');
var result = JSON.parse(values.body);
response.user.user_metadata.coshare = result;
console.log('RESULT NEW');
console.log(user);
cb(null, user, context);
} catch (e) {
console.log(e)
}
};
You may find this FAQ helpful as well: Is it possible to use async await in rules?