Hello :wave: when I use Pulumi Auth0 package: <htt...
# general
s
Hello 👋 when I use Pulumi Auth0 package: https://www.pulumi.com/registry/packages/auth0/api-docs/ to create Auth0 Action I get
400 Bad Request: trigger is not supported
for
post-user-registration
trigger: Code sample:
Copy code
const createIdentityAction = new auth0.Action('create-identity', {
  name: 'Create Identity',
  runtime: 'node16',
  code: fs.readFileSync(
    path.join(__dirname, './create-identity.js'),
    'utf-8'
  ),
  deploy: true,
  secrets,
  supportedTriggers: { id: 'post-user-registration', version: 'v3' },
  dependencies: [{ name: 'axios', version: '1.2.2' }]
});
And here is
create-identity.js
file:
Copy code
const axios = require('axios');

exports.onExecutePostUserRegistration = async (event, api) => {
  const { user_id: ssoId, email } = event.user;
  const {
    domain,
    clientId,
    clientSecret,
    audience,
    serverHost
  } = event.secrets;

  const options = {
    method: 'POST',
    url: `https://${domain}/oauth/token`,
    headers: { 'content-type': 'application/json' },
    data: {
      client_id: clientId,
      client_secret: clientSecret,
      audience,
      grant_type: 'client_credentials'
    }
  };

  const { access_token } = await axios(options).then(res => res.data);
  const headers = { Authorization: ['Bearer', access_token].join(' ') };
  const createIdentityRoute = `https://${serverHost}/api/identity`;

  // TODO: Implement retry strategy
  await <http://axios.post|axios.post>(createIdentityRoute, { ssoId, email }, { headers });
};
Does anyone know why I get
trigger is not supported
error if I basically copied trigger name from their website: https://auth0.com/docs/customize/actions/flows-and-triggers? I am using
"@pulumi/auth0": "^2.14.0"
I fixed this by changing trigger version from
v3
to
v2
. Just one suggestion: it would be great if you improve auth0 actions documentation and type safety by creating Trigger type that would allow only correct values. Keep doing great work Pulumi team! 🚀
m
Hey Ivo, I check the triggers via the https://auth0.com/docs/api/management/v2#!/Actions/get_triggers to see which version is supported! Not sure what would be good way. Maybe via PaC?