After you upgrade the Action to Node 22, can you please add the axios dependency on the latest version as axios@latest and test if that results in the same error message? This should automatically select the latest version which should offer the best compatibility settings for the Node version.
I have to apologise as I was not very clear with my indications, please allow me to try and provide more precise details. Before you add the const axios in your Action, axios will need to be added as a dependency as described in the following documentation here. When you have the code line opened for an Action, you will find a couple of icons/options to the left of the input box, which should be Test, Secrets, Dependencies and Rules.
Here is also a screenshot of the icons, from within an Action, with axios installed on the latest version :
Once the correct dependency ( in your case axios ) and it’s version ( latest ) has been added, it can then be called within the code as you have attempted. I have also found this documentation which further outlines how to add dependencies, either from the Auth0 dashboard or from the Auth0 Management API with the Create an action endpoint. Please do notice that in this second documentations, dependencies are referred to as Modules, but it references the same functionality.
Please let me know if you were able to get everything running correctly this time and do excuse any confusion that came from my end. Looking forward to your input!
Seems to be an ongoing problem that is not in a high priority to be fixed. In case anyone else is looking for a solution, seems like adding 'Accept-Encoding': 'gzip,deflate' to headers help resolve the error.