Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

await is only valid in async function #3

Closed
gustavoorsi opened this issue Feb 9, 2020 · 2 comments
Closed

await is only valid in async function #3

gustavoorsi opened this issue Feb 9, 2020 · 2 comments

Comments

@gustavoorsi
Copy link

No es un error en el codigo, seguramente es un tema de mi configuracion local. El error que estoy viendo es:

const serverStatus = await afip.ElectronicBilling.getServerStatus();
                     ^^^^^
SyntaxError: await is only valid in async function

Aclaro, tengo cero experiencia en js. Alguna idea de que puede ser ? (parece algo basico).

@ivanalemunioz
Copy link
Collaborator

Para usar await debes ejecutar el código dentro de una función async

@gustavoorsi
Copy link
Author

ok. Igualmente era solo para probar que este todo en orden. Calculo que de esta forma funcionaria igual:

afip.ElectronicBilling.getServerStatus().then( status => console.log(status));

Gracias por la respuesta.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants