Skip to content
This repository was archived by the owner on Jan 14, 2021. It is now read-only.
This repository was archived by the owner on Jan 14, 2021. It is now read-only.

PANIC: expected 0 parameters but got 1 (when running $executeRaw...) #940

@olfal

Description

@olfal

Hey 👋

I'm trying to run this simple statement, but I get a panic crash.

  const newPassword = 'ElitePassword';

  await prisma.$executeRaw`ALTER USER myUser WITH PASSWORD '${newPassword}'`;

Just in case, I've also tried without quoting the newPassword variable, but I get

Raw query failed. Code: `42601`. Message: `db error: ERROR: syntax error at or near ""$1""`

Finally, I can work around this by using the unsafe/deprecated version below, but I thought I'd let you know anyway, since this panic crash does not sound right.

prisma.executeRaw(`ALTER USER myUser WITH PASSWORD '${newPassword}'`)

I'm using Prisma with PostgreSQL 12, if that helps.

Here is the full crash report from the error prompt:

Hi Prisma Team! My Prisma Client just crashed. This is the report:

Versions

Name Version
Node v14.15.0
OS darwin
Prisma Client 2.11.0

Logs

  prisma-client {
  prisma-client   engineConfig: {
  prisma-client     cwd: '/Users/olfal/Projects/test/packages/database/prisma',
  prisma-client     enableDebugLogs: false,
  prisma-client     enableEngineDebugMode: undefined,
  prisma-client     datamodelPath: '/Users/olfal/Projects/test/node_modules/.prisma/client/schema.prisma',
  prisma-client     prismaPath: undefined,
  prisma-client     engineEndpoint: undefined,
  prisma-client     generator: {
  prisma-client       name: 'client',
  prisma-client       provider: 'prisma-client-js',
  prisma-client       output: '/Users/olfal/Projects/test/node_modules/@prisma/client',
  prisma-client       binaryTargets: [Array],
  prisma-client       previewFeatures: [],
  prisma-client       config: {}
  prisma-client     },
  prisma-client     showColors: false,
  prisma-client     logLevel: undefined,
  prisma-client     logQueries: undefined,
  prisma-client     flags: [],
  prisma-client     clientVersion: '2.11.0',
  prisma-client     enableExperimental: [],
  prisma-client     useUds: undefined
  prisma-client   }
  prisma-client }  
  plusX Execution permissions of /Users/olfal/Projects/test/node_modules/.prisma/client/query-engine-darwin are fine  
  prisma-client prisma.$executeRaw(ALTER USER myUser WITH PASSWORD '$1';, ["ElitePassword"])  
  prisma-client Prisma Client call:  
  plusX Execution permissions of /Users/olfal/Projects/test/node_modules/.prisma/client/query-engine-darwin are fine  
  plusX Execution permissions of /Users/olfal/Projects/test/node_modules/.prisma/client/query-engine-darwin are fine  
  plusX Execution permissions of /Users/olfal/Projects/test/node_modules/.prisma/client/query-engine-darwin are fine  
  plusX Execution permissions of /Users/olfal/Projects/test/node_modules/.prisma/client/query-engine-darwin are fine  

Metadata

Metadata

Assignees

Labels

kind/questionDeveloper asked a question. No code changes required.team/clientIssue for team Client.topic: raw

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions