Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RangeError: Invalid count value during npx prisma generate with DEBUG=* on integration build #9429

Closed
janpio opened this issue Sep 24, 2021 · 2 comments · Fixed by #16227
Closed
Labels
bug/2-confirmed Bug has been reproduced and confirmed. kind/bug A reported bug. team/client Issue for team Client. topic: cli topic: update-notifier
Milestone

Comments

@janpio
Copy link
Member

janpio commented Sep 24, 2021

Complete output:

gitpod /workspace/deployment-example-vercel $ npm install
npm WARN deprecated querystring@0.2.1: The querystring API is considered Legacy. new code should use the URLSearchParams API instead.
[ .................] - fetchMetadata: sill pacote version manifest for util@0.10.3 fetched in 35ms
npm WARN deprecated querystring@0.2.0: The querystring API is considered Legacy. new code should use the URLSearchParams API instead.

> prisma@3.1.0-integration-data-proxy-engine.1 preinstall /workspace/deployment-example-vercel/node_modules/prisma
> node scripts/preinstall-entry.js


> prisma@3.1.0-integration-data-proxy-engine.1 install /workspace/deployment-example-vercel/node_modules/prisma
> node scripts/install-entry.js


> @prisma/engines@3.1.0-2.eb8eb4c97238c32c9e71756e76d59ed5e502185a postinstall /workspace/deployment-example-vercel/node_modules/@prisma/engines
> node download/index.js


> @prisma/client@3.1.0-integration-data-proxy-engine.1 postinstall /workspace/deployment-example-vercel/node_modules/@prisma/client
> node scripts/postinstall.js

Prisma schema loaded from prisma/schema.prisma

✔ Generated Prisma Client (3.1.0-integration-data-proxy-engine.1) to ./node_modules/@prisma/client in 1.61s
You can now start using Prisma Client in your code. Reference: https://pris.ly/d/client
```
import { PrismaClient } from '@prisma/client'
const prisma = new PrismaClient()
```
npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@~2.3.1 (node_modules/chokidar/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.3.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm WARN deployment-example-prisma-vercel@ No repository field.
npm WARN deployment-example-prisma-vercel@ No license field.

added 276 packages from 228 contributors and audited 277 packages in 21.951s

47 packages are looking for funding
  run `npm fund` for details

found 1 moderate severity vulnerability
  run `npm audit fix` to fix them, or `npm audit` for details
gitpod /workspace/deployment-example-vercel $ npx prisma -v
prisma                  : 3.1.0-integration-data-proxy-engine.1
@prisma/client          : 3.1.0-integration-data-proxy-engine.1
Current platform        : debian-openssl-1.1.x
Query Engine (Node-API) : libquery-engine eb8eb4c97238c32c9e71756e76d59ed5e502185a (at node_modules/@prisma/engines/libquery_engine-debian-openssl-1.1.x.so.node)
Migration Engine        : migration-engine-cli eb8eb4c97238c32c9e71756e76d59ed5e502185a (at node_modules/@prisma/engines/migration-engine-debian-openssl-1.1.x)
Introspection Engine    : introspection-core eb8eb4c97238c32c9e71756e76d59ed5e502185a (at node_modules/@prisma/engines/introspection-engine-debian-openssl-1.1.x)
Format Binary           : prisma-fmt eb8eb4c97238c32c9e71756e76d59ed5e502185a (at node_modules/@prisma/engines/prisma-fmt-debian-openssl-1.1.x)
Default Engines Hash    : eb8eb4c97238c32c9e71756e76d59ed5e502185a
Studio                  : 0.423.0
gitpod /workspace/deployment-example-vercel $ export DEBUG="*"
gitpod /workspace/deployment-example-vercel $ npx prisma generate
  prisma:loadEnv project root found at /workspace/deployment-example-vercel/package.json +0ms
  prisma:tryLoadEnv Environment variables not found at null +0ms
  prisma:tryLoadEnv Environment variables not found at undefined +1ms
  prisma:tryLoadEnv No Environment variables loaded +0ms
  prisma:engines binaries to download libquery-engine, migration-engine, introspection-engine, prisma-fmt +0ms
Prisma schema loaded from prisma/schema.prisma
  prisma:getConfig Using CLI Query Engine (Node-API Library) at: /workspace/deployment-example-vercel/node_modules/prisma/libquery_engine-debian-openssl-1.1.x.so.node +0ms
  prisma:getDMMF Using CLI Query Engine (Node-API) at: /workspace/deployment-example-vercel/node_modules/prisma/libquery_engine-debian-openssl-1.1.x.so.node +0ms
  prisma:generator prismaCLIDir /workspace/deployment-example-vercel/node_modules/prisma +0ms
  prisma:generator prismaClientDir /workspace/deployment-example-vercel/node_modules/@prisma/client +0ms
  prisma:generator baseDir /workspace/deployment-example-vercel/prisma +0ms
  prisma:GeneratorProcess 2021-09-24T18:07:26.887Z prisma:client:generator requiredEngine: queryEngine +0ms
  prisma:getGenerators neededVersions {
  "eb8eb4c97238c32c9e71756e76d59ed5e502185a": {
    "engines": [
      "queryEngine"
    ],
    "binaryTargets": []
  }
} +0ms
  prisma:getGenerators {
  prisma:getGenerators   generatorBinaryPaths: {
  prisma:getGenerators     queryEngine: {
  prisma:getGenerators       'debian-openssl-1.1.x': '/workspace/deployment-example-vercel/node_modules/prisma/query-engine-debian-openssl-1.1.x'
  prisma:getGenerators     }
  prisma:getGenerators   }
  prisma:getGenerators } +350ms
  prisma:GeneratorProcess 2021-09-24T18:07:27.285Z prisma:loadEnv skipping package.json at /workspace/deployment-example-vercel/node_modules/.prisma/package.json +396ms
  prisma:GeneratorProcess 2021-09-24T18:07:27.285Z prisma:loadEnv skipping package.json at /workspace/deployment-example-vercel/node_modules/package.json +1ms
  prisma:GeneratorProcess 2021-09-24T18:07:27.286Z prisma:loadEnv project root found at /workspace/deployment-example-vercel/package.json +0ms
  prisma:tryLoadEnv Environment variables not found at null +0ms
  prisma:tryLoadEnv Environment variables not found at undefined +1ms
  prisma:tryLoadEnv No Environment variables loaded +0ms

✔ Generated Prisma Client (3.1.0-integration-data-proxy-engine.1) to ./node_modules/@prisma/client in 1.06s
You can now start using Prisma Client in your code. Reference: https://pris.ly/d/client
```
import { PrismaClient } from '@prisma/client'
const prisma = new PrismaClient()
```
  prisma:getConfig Using CLI Query Engine (Node-API Library) at: /workspace/deployment-example-vercel/node_modules/@prisma/engines/libquery_engine-debian-openssl-1.1.x.so.node +2s
  prisma:cli RangeError: Invalid count value
  prisma:cli     at String.repeat (<anonymous>)
  prisma:cli     at /workspace/deployment-example-vercel/node_modules/prisma/build/index.js:11170:178
  prisma:cli     at Array.map (<anonymous>)
  prisma:cli     at Object.drawBox3 (/workspace/deployment-example-vercel/node_modules/prisma/build/index.js:11167:46)
  prisma:cli     at printUpdateMessage (/workspace/deployment-example-vercel/node_modules/prisma/build/index.js:116472:37)
  prisma:cli     at main (/workspace/deployment-example-vercel/node_modules/prisma/build/index.js:116641:7) +0ms
gitpod /workspace/deployment-example-vercel $

Happens on https://github.com/prisma/deployment-example-vercel/tree/data-proxy (https://github.com/prisma/deployment-example-vercel/tree/bbdc029d89bc66e74d58ce87022dbe88f9fd23e0)

Reproduction steps:

  1. Open https://github.com/prisma/deployment-example-vercel/tree/bbdc029d89bc66e74d58ce87022dbe88f9fd23e0 in Gitpod
  2. npm install
  3. npx prisma -v
  4. export DEBUG="*"
  5. npx prisma generate
  6. Observe the error as above 😢

(Only works the first time you run generate because of how the update notifier is supposed to work I guess)

Version info

prisma                  : 3.1.0-integration-data-proxy-engine.1
@prisma/client          : 3.1.0-integration-data-proxy-engine.1
Current platform        : debian-openssl-1.1.x
Query Engine (Node-API) : libquery-engine eb8eb4c97238c32c9e71756e76d59ed5e502185a (at node_modules/@prisma/engines/libquery_engine-debian-openssl-1.1.x.so.node)
Migration Engine        : migration-engine-cli eb8eb4c97238c32c9e71756e76d59ed5e502185a (at node_modules/@prisma/engines/migration-engine-debian-openssl-1.1.x)
Introspection Engine    : introspection-core eb8eb4c97238c32c9e71756e76d59ed5e502185a (at node_modules/@prisma/engines/introspection-engine-debian-openssl-1.1.x)
Format Binary           : prisma-fmt eb8eb4c97238c32c9e71756e76d59ed5e502185a (at node_modules/@prisma/engines/prisma-fmt-debian-openssl-1.1.x)
Default Engines Hash    : eb8eb4c97238c32c9e71756e76d59ed5e502185a
Studio                  : 0.423.0
@janpio
Copy link
Member Author

janpio commented Sep 24, 2021

Reference line in error message is in this code, the return line:

  function drawBox3({
    title,
    width,
    height,
    str,
    horizontalPadding
  }) {
    horizontalPadding = horizontalPadding || 0;
    width = width || maxLineLength(str) + horizontalPadding * 2;
    const topLine = title ? import_chalk14.default.grey(chars.topLeft + chars.horizontal) + " " + import_chalk14.default.reset.bold(title) + " " + import_chalk14.default.grey(chars.horizontal.repeat(width - title.length - 2 - 3) + chars.topRight) + import_chalk14.default.reset() : import_chalk14.default.grey(chars.topLeft + chars.horizontal) + import_chalk14.default.grey(chars.horizontal.repeat(width - 3) + chars.topRight);
    const bottomLine = chars.bottomLeft + chars.horizontal.repeat(width - 2) + chars.bottomRight;
    const lines = str.split("\n");
    if (lines.length < height) {
      lines.push(...new Array(height - lines.length).fill(""));
    }
    const mappedLines = lines.slice(-height).map((l) => {
      const lineWidth = Math.min((0, import_string_width.default)(l), width);
      const paddingRight = Math.max(width - lineWidth - 2, 0);
      return `${import_chalk14.default.grey(chars.vertical)}${" ".repeat(horizontalPadding)}${import_chalk14.default.reset((0, import_cli_truncate.default)(l, width - 2))}${" ".repeat(paddingRight - horizontalPadding)}${import_chalk14.default.grey(chars.vertical)}`;
    }).join("\n");
    return import_chalk14.default.grey(topLine + "\n" + mappedLines + "\n" + bottomLine);
  }
});

The character references this: repeat(paddingRight - horizontalPadding) in that line.

@janpio janpio added topic: update-notifier bug/1-unconfirmed Bug should have enough information for reproduction, but confirmation has not happened yet. kind/bug A reported bug. team/client Issue for team Client. topic: cli labels Sep 24, 2021
@janpio janpio changed the title RangeError: Invalid count value during npx prisma generate with DEBUG=* RangeError: Invalid count value during npx prisma generate with DEBUG=* on integration build Sep 24, 2021
@pantharshit00 pantharshit00 added bug/2-confirmed Bug has been reproduced and confirmed. and removed bug/1-unconfirmed Bug should have enough information for reproduction, but confirmation has not happened yet. labels Oct 4, 2021
@janpio
Copy link
Member Author

janpio commented Oct 14, 2022

Just got this again while running npx prisma studio in the VSCode terminal. My Prisma version I am using is prboably not the newest, so it might have wanted to suggest that I upgrade.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug/2-confirmed Bug has been reproduced and confirmed. kind/bug A reported bug. team/client Issue for team Client. topic: cli topic: update-notifier
Projects
None yet
2 participants