Hey @artem2 no problem, happy to help!
Hmm that’s interesting - I see both API operations in my logging (create org and assign member) using the following Action. Again it’s a bit more simplified version of yours, primarily skipping the domain bit and just hardcoding the org name:
const ManagementClient = require('auth0').ManagementClient;
exports.onExecutePostLogin = async (event, api) => {
const management = new ManagementClient({
domain: event.secrets.AUTH0_DOMAIN,
clientId: event.secrets.CLIENT_ID,
clientSecret: event.secrets.CLIENT_SECRET
});
const data = {"name": "test_org_test"}
const user = event.user.user_id
console.log(`Here's the user ${user}`)
management.organizations.create(data, function (err, response) {
if (err) {
// Handle error.
}
//org created
var org_id = response.id
var params = { id : org_id}
var data = { members: [ user ] }
management.organizations.addMembers(params, data, function (err, response) {
if (err) {
// Handle error.
}
});
});
I’m wondering if it could be breaking down at your user_domain
related code or another Action could be causing issues with this one.