Prisma-client-js: ReferenceError: message is not defined

Created on 3 Mar 2020  路  5Comments  路  Source: prisma/prisma-client-js

Generated client

Version: preview022, preview023

Reference error in catch body when the request throws an error does not have a callsite, and !e.isPanic. The message is not defined, which I assume should be e.message

      if (callsite) {
        const { stack } = printStack({
          callsite,
          originalMethod: clientMethod,
          onUs: e.isPanic
        });
        const message = stack + e.message;
        if (e.code) {
          throw new PrismaClientKnownRequestError(this.sanitizeMessage(message), e.code, e.meta);
        }
        if (e instanceof PrismaClientUnknownRequestError) {
          throw new PrismaClientUnknownRequestError(this.sanitizeMessage(message));
        } else if (e instanceof PrismaClientInitializationError) {
          throw new PrismaClientInitializationError(this.sanitizeMessage(message));
        } else if (e instanceof PrismaClientRustPanicError) {
          throw new PrismaClientRustPanicError(this.sanitizeMessage(message));
        }
      } else {
        if (e.code) {
          throw new PrismaClientKnownRequestError(this.sanitizeMessage(e.message), e.code, e.meta);
        }
        if (e.isPanic) {
          throw new PrismaClientRustPanicError(e.message);
        } else {
          if (e instanceof PrismaClientUnknownRequestError) {
            // HERE
            throw new PrismaClientUnknownRequestError(this.sanitizeMessage(message));
          } else if (e instanceof PrismaClientInitializationError) {
            // HERE
            throw new PrismaClientInitializationError(this.sanitizeMessage(message));
          } else if (e instanceof PrismaClientRustPanicError) {
            // HERE
            throw new PrismaClientRustPanicError(this.sanitizeMessage(message));
          }
        }
      }
bu0-needs-info kinbug

Most helpful comment

@pantharshit00 not much to repro

you can init prisma by starter example (or any other running project with preview022, preview023). Generate client and go to node_modules/@prisma/client/index.jsgo to lines 104, 106, 108 and see that variable message is not defined, and should be e.message

All 5 comments

@turboxx observed the same thing! So this happens in error case, right?

i am asking because we have this error on a "post-install" pipeline (it does a seed after deployment) and i am figuring out what is going wrong there.

@macrozone yes it's the catch block of the PrismaClientFetcher.request

@turboxx Can you please provide a reproduction for this?

@pantharshit00 not much to repro

you can init prisma by starter example (or any other running project with preview022, preview023). Generate client and go to node_modules/@prisma/client/index.jsgo to lines 104, 106, 108 and see that variable message is not defined, and should be e.message

Thanks a lot for reporting 馃檹
This issue is fixed in the latest alpha version of prisma2.
You can try it out with npm i -g prisma2@alpha.

In case it鈥檚 not fixed for you - please let us know and we鈥檒l reopen this issue!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

divyenduz picture divyenduz  路  3Comments

FluorescentHallucinogen picture FluorescentHallucinogen  路  3Comments

divyenduz picture divyenduz  路  3Comments

AhmedElywa picture AhmedElywa  路  4Comments

divyenduz picture divyenduz  路  3Comments