Actions don't support ESM?

I’m trying to setup my first action but it seems like they don’t allow importing ESM modules.

//const ky = require('ky') // errors because ky is an esm module
import ky from 'ky' // errors because action is not running inside a type: package

exports.onExecutePostUserRegistration = async (event, api) => {
  const HOOK_URL = 'abc.com'
  const SECRET = event.secrets.AUTH0_HOOK_SECRET
  
  const json = await ky.post(HOOK_URL, {json: { user: event.user, secret: SECRET }}).json();
}

Am I unable to use any ESM packages?

I just switched to AXIOS which works fine. We use ky in our app so it’d be nice to stay consistent.

Hi @botsko.

Welcome to the Auth0 Community!

Unfortunately, the ky module is not currently supported with using Auth0 Actions.

A full list of available modules can be found here:
https://auth0-extensions.github.io/canirequire/

In this scenario, I recommend using the Axios package to make an HTTP Post request in a Post-User Registration Action.

I hope this helps!

Please let me know if you have any additional questions.

Thanks,
Rueben