Hi,
I am learning this API guide - User Provisioning Guide
It mentions:
To use the alternative user-provisioning-service.js
script, which enables you to run the script's create-user code as a REST-based service, use the following procedure:
a. Change to the src
directory and then run node user-provisioning-service.js.
b. After the service is started
I used the code sample on GitHub. GitHub - MyPureCloud/user-provisioning-scripts-js: User provisioning scripts that will be used for our user management developer tutorials.
I tried the same command and encountered an error as follows.
C:\git_localdir_2024\github_junxu_user-provisioning-scripts-js\src>node user-provisioning-service.js
C:\git_localdir_2024\github_junxu_user-provisioning-scripts-js\src\user-provisioning-service.js:14
const response = await authApiProxy.authenticate(
^^^^^
SyntaxError: await is only valid in async functions and the top level bodies of modules
at internalCompileFunction (node:internal/vm:77:18)
at wrapSafe (node:internal/modules/cjs/loader:1288:20)
at Module._compile (node:internal/modules/cjs/loader:1340:27)
at Module._extensions..js (node:internal/modules/cjs/loader:1435:10)
at Module.load (node:internal/modules/cjs/loader:1207:32)
at Module._load (node:internal/modules/cjs/loader:1023:12)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:135:12)
at node:internal/main/run_main_module:28:49
Node.js v20.11.1
Can you please help check what the root cause of it? How to address it? Thank you!
James Xu