grafana/k6 · error

cdnjs.com 'special' urls are no longer supported - please us

Error message

cdnjs.com 'special' urls are no longer supported - please use real ones. You can get yours by going to cdnjs and copy-pasting the full url to the actual JavaScript file

What it means

An explicit deprecation guard in Resolve. k6 used to resolve shorthand cdnjs.com URLs; it now rejects them because resolution is ambiguous. It fires whenever a module specifier starts with 'cdnjs.com'.

Source

Thrown at internal/loader/loader.go:74

	if strings.Contains(moduleSpecifier, "://") {
		u, err := url.Parse(moduleSpecifier)
		if err != nil {
			return nil, err
		}
		if u.Scheme != "file" && u.Scheme != "https" {
			return nil,
				fmt.Errorf("only supported schemes for imports are file and https, %s has `%s`",
					moduleSpecifier, u.Scheme)
		}
		if u.Scheme == "file" && pwd.Scheme == "https" {
			return nil, fmt.Errorf("origin (%s) not allowed to load local file: %s", pwd, moduleSpecifier)
		}
		return u, err
	}

	if strings.HasPrefix(moduleSpecifier, "cdnjs.com") {
		return nil, fmt.Errorf("cdnjs.com 'special' urls are no longer supported - please use real ones. " +
			"You can get yours by going to cdnjs and copy-pasting the full url to the actual JavaScript file")
	}
	if strings.HasPrefix(moduleSpecifier, "github.com") {
		return nil, fmt.Errorf("github.com 'special' urls are no longer supported - please use real ones. " +
			"You can get yours by going to github and copy-pasting the full url to the actual raw JavaScript file")
	}
	return nil, unresolvableURLError(moduleSpecifier)
}

func resolveFilePath(pwd *url.URL, moduleSpecifier string) (*url.URL, error) {
	if pwd.Opaque != "" { // this is a loader reference
		base, dir, _ := strings.Cut(pwd.Opaque, "/")
		if moduleSpecifier[0] == '/' {
			return &url.URL{Opaque: path.Join(base, moduleSpecifier)}, nil
		}
		return &url.URL{Opaque: path.Join(base, path.Join(path.Dir(dir+"/"), moduleSpecifier))}, nil
	}

View on GitHub (pinned to 01ffac6f24)

Solutions

  1. Browse cdnjs, open the actual JavaScript file, and copy its full https:// URL
  2. Replace the 'cdnjs.com/...' specifier with the concrete https://cdnjs.cloudflare.com/... file URL
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at internal/loader/loader.go:74 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of grafana/k6@01ffac6f24 (2026-08-18). Data as JSON: /api/errors/7b42911e64e448b2. Report an issue: GitHub.