error TS1308: 'await' expression is only allowed within an async function.
JonAmuchastegui opened this issue · 1 comments
JonAmuchastegui commented
After istalling the necesary dependecys and run the yarm command i have tried tu use the script on the readme file in the usage paragraph but i get the next errors.
../../src/prueba.ts:14:1 - error TS1308: 'await' expression is only allowed within an async function.
14 await kcAdminClient.auth({
../../src/prueba.ts:22:15 - error TS1308: 'await' expression is only allowed within an async function.
22 const users = await kcAdminClient.users.find();
~~~~~
../../src/prueba.ts:30:17 - error TS1308: 'await' expression is only allowed within an async function.
30 const groups = await kcAdminClient.groups.find();
~~~~~
../../src/prueba.ts:34:1 - error TS1308: 'await' expression is only allowed within an async function.
34 await this.kcAdminClient.users.create({
I am completely new with scripts i now some java and C but i have never used scripts before. Probably its a simple mistake but i dont undertand enought to solve the problem.
If someone has the patient to tell to a script kiddie what is what i made wrong , i would be really grateful.
wwwy3y3 commented
@JonAmuchastegui this error is not raised from keycloak-admin
.
At your own script (../../src/prueba.ts:22:15
), you need to wrap await
with async
function.
Just google js async await
to learn more about it. 😊