typeorm/typeorm · error · TypeORMError

To use streams you should install pg-query-stream package. P

Error message

To use streams you should install pg-query-stream package. Please run "npm i pg-query-stream".

What it means

Error "To use streams you should install pg-query-stream package. Please run "npm i pg-query-stream"." thrown in typeorm/typeorm.

Source

Thrown at src/driver/cockroachdb/CockroachDriver.ts:1130

     * @param index
     */
    createParameter(parameterName: string, index: number): string {
        return this.parametersPrefix + (index + 1)
    }

    // -------------------------------------------------------------------------
    // Public Methods
    // -------------------------------------------------------------------------

    /**
     * Loads postgres query stream package.
     */
    loadStreamDependency() {
        try {
            return PlatformTools.load("pg-query-stream")
        } catch {
            // todo: better error for browser env
            throw new TypeORMError(
                `To use streams you should install pg-query-stream package. Please run "npm i pg-query-stream".`,
            )
        }
    }

    // -------------------------------------------------------------------------
    // Protected Methods
    // -------------------------------------------------------------------------

    /**
     * If driver dependency is not given explicitly, then try to load it via "require".
     */
    protected loadDependencies(): void {
        try {
            const postgres = this.options.driver ?? PlatformTools.load("pg")
            this.postgres = postgres
            try {
                const pgNative =

View on GitHub (pinned to 04ff4daedc)

Solutions

  1. Install the streaming package: npm i pg-query-stream
  2. Avoid using query streaming if you cannot add the dependency; use getMany() instead.

When it happens

Trigger: QueryRunner.stream() is called on a CockroachDB connection without the optional pg-query-stream package installed in the project.

Common situations: See trigger scenarios.


AI-assisted analysis of typeorm/typeorm@04ff4daedc (2026-08-03). Data as JSON: /data/errors/e3618df201d7dd1b.json. Report an issue: GitHub.