Automatic local extension loading

I was happy to see that it is now possible to automatically load extensions, without building a custom k6 binary. I have a case where I need to test a postgres database, so let’s use it!

INFO[0000] Automatic extension resolution is enabled. The current k6 binary doesn’t satisfy all dependencies, it’s required to provision a custom binary. deps=“k6;k6/x/sql;k6/x/sql/driver/postgres”
ERRO[0000] Failed to provision a k6 binary with required dependencies. Please, make sure to report this issue by opening a bug report. error="building binary: request failed: Post “https:// ingest. k6. io/builder/api/v1/build": dial tcp: lookup ingest.k6.io: no such host”
ERRO[0000] building binary: request failed: Post “https:// ingest. k6. io/builder/api/v1/build”: dial tcp: lookup ingest.k6.io: no such host

this makes sense, as the network where I’m at does block a lot.

So I want to load these extensions automatically from a local source, something like replacing:

import sql from 'k6/x/sql';
import driver from 'k6/x/sql/driver/postgres';

by:

import sql from 'local/path/sql';
import driver from 'local/path/postgres';

But where do I download these from?

On github xk6-sql seems to provide binaries, but xk6-sql-driver-postgres doesn’t. And the k6 binary itself tries from ingestor anyway.

Hey @martind62a! The automatic dependency resolution relies on the Grafana k6 buider service to be reachable, so k6 can provision the binary that includes these extensions. Without it you can still rely on xk6 to create a custom k6 build with all necessary extensions. The extension catalog lists available extensions and links to their repositories, including xk6-sql and xk6-sql-driver-postgres.

Hi @andrewslotin ,

Thanks for your quick response!

That is a pity, I understood from the earlier release notes that there was now something like the jmeter plugin system that didn’t require to build yourself anymore. But as you explains this turns out to be an automated building platform. So I’ll have to build my own binary, let’s go :slight_smile: