You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
importsqlfrom"k6/x/sql";importdriverfrom"k6/x/sql/driver/postgres";constdb=sql.open(driver,"");exportfunctionsetup(){}exportfunctionteardown(){db.close();}exportdefaultfunction(){letresult=db.exec(` INSERT INTO roster (given_name, family_name) VALUES ('Peter', 'Pan'); `);console.log(`${result.rowsAffected()} rows inserted`);letrows=db.query("SELECT * FROM roster WHERE given_name = $1;","Peter");for(constrowofrows){console.log(`${row.family_name}, ${row.given_name}`);}}
When I run ./k6 run src/postgres-test.js, it works as expected. But if I run ./k6 run dist/postgres-test.js (the bundled file), it fails with the error aforementioned.
I'v tried different version of JavaScript (from 14 to 22) and different versions of k6 (from 45 to 55). The issue seems to be specific to "k6/x/sql/driver/postgres" (e.g. my code can call sql.open).
I got the same issue with postgres driver. I did compile test cases from Typescript to JavaScript and fail with error unsupported database: invalid driver parameter type. It used to work before the breaking changes.
I have a basic test that write to PostgreSQL. If I run it directly using
k6
, it works. If I transpile and bundle it, it fails with the below error:I added a test to https://github.com/grafana/k6-template-es6 (I realize this is deprecated, but it uses similar tooling than the code base I'm trying to fix).
The test in question:
When I run
./k6 run src/postgres-test.js
, it works as expected. But if I run./k6 run dist/postgres-test.js
(the bundled file), it fails with the error aforementioned.I'v tried different version of JavaScript (from
14
to22
) and different versions ofk6
(from45
to55
). The issue seems to be specific to"k6/x/sql/driver/postgres"
(e.g. my code can callsql.open
).Configuration:
The text was updated successfully, but these errors were encountered: