Open GeorgeXCV opened 1 year ago
Hey @GeorgeXCV 👋🏻
Sorry for the delay in addressing this. The notification slipped under my radar.
I believe you're experiencing a lack of support for the for-await
syntax in k6's JS runtime: goja. I'm reading that the for-await
syntax is part of the ECMAScript 2018-2019 specification, but our JS runtime is only compatible with ES5.1, and mostly compatible with ES6.
@mstoykov might have more insights into this as he is the maintainer who works the most actively on the runtime, and might be able to offer some alternatives 🙇🏻
for-await of is in practice the way to iterate async iterable objects.
But those are basically not supported in goja. The commit adding generators specifically only added synchrnous ones and I have no idea why the async iterables weren't added.
Currently I will recommedn using babel to transpile the code, but the exact configuration will be more involved.
On the other hand I will expect that even if you manage to get this working @google-cloud/secret-manager
will want to make some kind of http request at some point and it will likely try an fetch API which k6 does not support.
So unfortunately my proposal will be to write the http requests needed to access secret manager by hand using the API k6 provides. We have done something similar for aws in https://github.com/grafana/k6-jslib-aws, but I don't think anyone has shared something similar for google
Brief summary
I am using this template for my project https://github.com/grafana/k6-template-typescript
One test runs fine, but in another, I got like 50 module errors, so had to add them to my webpack config and install them manually. Now the other test file runs but I get an error related to an unexpected token but I don't have any for loops in my project. Can you help me fix this error please?
Here is my test file that runs fine without any problem:
k6 version
k6 javascript module
OS
13.5
Docker version and image (if applicable)
No response
Steps to reproduce the problem
Here is the test file I get an unexpected token error:
Here is the GoogleCloud file:
Here is the package.json:
Expected behaviour
Sign up test file runs successfully, just like my other test file.
Actual behaviour
I get the following error when I run sign up test: