question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Command failed (AtlasError): Pipeline length greater than 50 not supported)

See original GitHub issue

Bug description

I’m running an upsert which succeeds on create and then fails on update with the following error.

error - PrismaClientUnknownRequestError: 
Invalid `prisma.standing.upsert()` invocation:


Error occurred during query execution:
ConnectorError(ConnectorError { user_facing_error: None, kind: RawDatabaseError { code: "unknown", message: "Command failed (AtlasError): Pipeline length greater than 50 not supported)" } })
    at RequestHandler.handleRequestError (/myapp/node_modules/@prisma/client/runtime/index.js:29913:13)
    at RequestHandler.request (/myapp/node_modules/@prisma/client/runtime/index.js:29892:12)
    at async PrismaClient._request (/myapp/node_modules/@prisma/client/runtime/index.js:30864:16)
    at async eval (webpack-internal:///(api)/./pages/api/import/[...route].ts:89:32) {
  clientVersion: '4.3.1',
  page: '/api/import/[...route]'

Here is the call prior to the above error:

  prisma:client  Prisma Client call: +1s
  prisma:client  prisma.standing.upsert({
  create: {
    awayLosses: 0,
    awayTies: 0,
    awayWins: 0,
    calendarYear: 2022,
    conferenceId: 958267392,
    confLosses: 0,
    conferenceName: 'AFC',
    confTies: 0,
    confWins: 0,
    capRoom: 218200000,
    capAvailable: 27850000,
    capSpent: 190350000,
    defPassYds: 0,
    defPassYdsRank: 8,
    defRushYds: 0,
    defRushYdsRank: 8,
    defTotalYds: 0,
    defTotalYdsRank: 8,
    divisionId: 969539585,
    divLosses: 0,
    divisionName: 'AFC North',
    divTies: 0,
    divWins: 0,
    homeLosses: 0,
    homeTies: 0,
    homeWins: 0,
    netPts: 0,
    offPassYds: 0,
    offPassYdsRank: 8,
    offRushYds: 0,
    offRushYdsRank: 8,
    offTotalYds: 0,
    offTotalYdsRank: 8,
    ptsAgainstRank: 8,
    ptsForRank: 8,
    playoffStatus: 0,
    prevRank: 0,
    ptsAgainst: 0,
    ptsFor: 0,
    rank: 0,
    seed: 0,
    seasonIndex: 0,
    stageIndex: 0,
    totalLosses: 0,
    totalTies: 0,
    totalWins: 0,
    teamId: 972030012,
    teamName: 'Ravens',
    teamOvr: 82,
    tODiff: 0,
    weekIndex: 0,
    winLossStreak: 0,
    winPct: 0,
    leagueId: 2363725
  },
  update: {
    awayLosses: 0,
    awayTies: 0,
    awayWins: 0,
    calendarYear: 2022,
    conferenceId: 958267392,
    confLosses: 0,
    conferenceName: 'AFC',
    confTies: 0,
    confWins: 0,
    capRoom: 218200000,
    capAvailable: 27850000,
    capSpent: 190350000,
    defPassYds: 0,
    defPassYdsRank: 8,
    defRushYds: 0,
    defRushYdsRank: 8,
    defTotalYds: 0,
    defTotalYdsRank: 8,
    divisionId: 969539585,
    divLosses: 0,
    divisionName: 'AFC North',
    divTies: 0,
    divWins: 0,
    homeLosses: 0,
    homeTies: 0,
    homeWins: 0,
    netPts: 0,
    offPassYds: 0,
    offPassYdsRank: 8,
    offRushYds: 0,
    offRushYdsRank: 8,
    offTotalYds: 0,
    offTotalYdsRank: 8,
    ptsAgainstRank: 8,
    ptsForRank: 8,
    playoffStatus: 0,
    prevRank: 0,
    ptsAgainst: 0,
    ptsFor: 0,
    rank: 0,
    seed: 0,
    seasonIndex: 0,
    stageIndex: 0,
    totalLosses: 0,
    totalTies: 0,
    totalWins: 0,
    teamId: 972030012,
    teamName: 'Ravens',
    teamOvr: 82,
    tODiff: 0,
    weekIndex: 0,
    winLossStreak: 0,
    winPct: 0,
    leagueId: 2363725
  },
  where: {
    leagueId_teamId: {
      leagueId: 2363725,
      teamId: 972030012
    }
  }
}) +1ms
  prisma:client  Generated request: +0ms
  prisma:client  mutation {
  upsertOneStanding(
    create: {
      awayLosses: 0
      awayTies: 0
      awayWins: 0
      calendarYear: 2022
      conferenceId: 958267392
      confLosses: 0
      conferenceName: "AFC"
      confTies: 0
      confWins: 0
      capRoom: 218200000
      capAvailable: 27850000
      capSpent: 190350000
      defPassYds: 0
      defPassYdsRank: 8
      defRushYds: 0
      defRushYdsRank: 8
      defTotalYds: 0
      defTotalYdsRank: 8
      divisionId: 969539585
      divLosses: 0
      divisionName: "AFC North"
      divTies: 0
      divWins: 0
      homeLosses: 0
      homeTies: 0
      homeWins: 0
      netPts: 0
      offPassYds: 0
      offPassYdsRank: 8
      offRushYds: 0
      offRushYdsRank: 8
      offTotalYds: 0
      offTotalYdsRank: 8
      ptsAgainstRank: 8
      ptsForRank: 8
      playoffStatus: 0
      prevRank: 0
      ptsAgainst: 0
      ptsFor: 0
      rank: 0
      seed: 0
      seasonIndex: 0
      stageIndex: 0
      totalLosses: 0
      totalTies: 0
      totalWins: 0
      teamId: 972030012
      teamName: "Ravens"
      teamOvr: 82
      tODiff: 0
      weekIndex: 0
      winLossStreak: 0
      winPct: 0
      leagueId: 2363725
    }
    update: {
      awayLosses: 0
      awayTies: 0
      awayWins: 0
      calendarYear: 2022
      conferenceId: 958267392
      confLosses: 0
      conferenceName: "AFC"
      confTies: 0
      confWins: 0
      capRoom: 218200000
      capAvailable: 27850000
      capSpent: 190350000
      defPassYds: 0
      defPassYdsRank: 8
      defRushYds: 0
      defRushYdsRank: 8
      defTotalYds: 0
      defTotalYdsRank: 8
      divisionId: 969539585
      divLosses: 0
      divisionName: "AFC North"
      divTies: 0
      divWins: 0
      homeLosses: 0
      homeTies: 0
      homeWins: 0
      netPts: 0
      offPassYds: 0
      offPassYdsRank: 8
      offRushYds: 0
      offRushYdsRank: 8
      offTotalYds: 0
      offTotalYdsRank: 8
      ptsAgainstRank: 8
      ptsForRank: 8
      playoffStatus: 0
      prevRank: 0
      ptsAgainst: 0
      ptsFor: 0
      rank: 0
      seed: 0
      seasonIndex: 0
      stageIndex: 0
      totalLosses: 0
      totalTies: 0
      totalWins: 0
      teamId: 972030012
      teamName: "Ravens"
      teamOvr: 82
      tODiff: 0
      weekIndex: 0
      winLossStreak: 0
      winPct: 0
      leagueId: 2363725
    }
    where: {
      leagueId_teamId: {
        leagueId: 2363725
        teamId: 972030012
      }
    }
  ) {
    id
    leagueId
    teamId
    awayLosses
    awayTies
    awayWins
    calendarYear
    capAvailable
    capRoom
    capSpent
    confLosses
    confTies
    confWins
    conferenceId
    conferenceName
    defPassYds
    defPassYdsRank
    defRushYds
    defRushYdsRank
    defTotalYds
    defTotalYdsRank
    divLosses
    divTies
    divWins
    divisionId
    divisionName
    homeLosses
    homeTies
    homeWins
    netPts
    offPassYds
    offPassYdsRank
    offRushYds
    offRushYdsRank
    offTotalYds
    offTotalYdsRank
    playoffStatus
    prevRank
    ptsAgainst
    ptsAgainstRank
    ptsFor
    ptsForRank
    rank
    seasonIndex
    seed
    stageIndex
    tODiff
    teamName
    teamOvr
    totalLosses
    totalTies
    totalWins
    weekIndex
    winLossStreak
    winPct
  }
}

How to reproduce

  1. Run an upsert with fresh data
  2. Run an upsert with the same data (to trigger an update)

Expected behavior

upsert works for create like it does for update.

Prisma information

generator client {
  provider        = "prisma-client-js"
  previewFeatures = ["fullTextIndex"]
}

datasource db {
  provider = "mongodb"
  url      = env("DATABASE_URL")
}

model Standing {
  id       String @id @default(auto()) @map("_id") @db.ObjectId
  leagueId Int
  league   League @relation(fields: [leagueId], references: [leagueId])
  teamId   Int
  team     Team   @relation(fields: [teamId, leagueId], references: [teamId, leagueId])

  awayLosses      Int?
  awayTies        Int?
  awayWins        Int?
  calendarYear    Int?
  capAvailable    Int?
  capRoom         Int?
  capSpent        Int?
  confLosses      Int?
  confTies        Int?
  confWins        Int?
  conferenceId    Int?
  conferenceName  String
  defPassYds      Int?
  defPassYdsRank  Int?
  defRushYds      Int?
  defRushYdsRank  Int?
  defTotalYds     Int?
  defTotalYdsRank Int?
  divLosses       Int?
  divTies         Int?
  divWins         Int?
  divisionId      Int?
  divisionName    String?
  homeLosses      Int?
  homeTies        Int?
  homeWins        Int?
  netPts          Int?
  offPassYds      Int?
  offPassYdsRank  Int?
  offRushYds      Int?
  offRushYdsRank  Int?
  offTotalYds     Int?
  offTotalYdsRank Int?
  playoffStatus   Int?
  prevRank        Int?
  ptsAgainst      Int?
  ptsAgainstRank  Int?
  ptsFor          Int?
  ptsForRank      Int?
  rank            Int?
  seasonIndex     Int?
  seed            Int?
  stageIndex      Int?
  tODiff          Int?
  teamName        String?
  teamOvr         Int?
  totalLosses     Int?
  totalTies       Int?
  totalWins       Int?
  weekIndex       Int?
  winLossStreak   Int?
  winPct          Float?

  @@unique([leagueId, teamId])
}
        const result = await prisma.standing.upsert({
          create: data,
          update: data,
          where: {
            leagueId_teamId: {
              leagueId,
              teamId: d.teamId,
            },
          },
        });

Environment & setup

  • OS: macOS
  • Database: MongoDB
  • Node.js version: v16.14.0

Prisma Version

Environment variables loaded from .env
prisma                  : 4.3.1
@prisma/client          : 4.3.1
Current platform        : darwin
Query Engine (Node-API) : libquery-engine c875e43600dfe042452e0b868f7a48b817b9640b (at node_modules/@prisma/engines/libquery_engine-darwin.dylib.node)
Migration Engine        : migration-engine-cli c875e43600dfe042452e0b868f7a48b817b9640b (at node_modules/@prisma/engines/migration-engine-darwin)
Introspection Engine    : introspection-core c875e43600dfe042452e0b868f7a48b817b9640b (at node_modules/@prisma/engines/introspection-engine-darwin)
Format Binary           : prisma-fmt c875e43600dfe042452e0b868f7a48b817b9640b (at node_modules/@prisma/engines/prisma-fmt-darwin)
Format Wasm             : @prisma/prisma-fmt-wasm 4.3.0-32.c875e43600dfe042452e0b868f7a48b817b9640b
Default Engines Hash    : c875e43600dfe042452e0b868f7a48b817b9640b
Studio                  : 0.473.0
Preview Features        : fullTextIndex

Issue Analytics

  • State:open
  • Created a year ago
  • Comments:13 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
do4grcommented, Sep 20, 2022

We’re about to look into this but can’t yet say whether it’s a big issue or a quick fix since we haven’t reproduce it yet. I’ll post an update as soon as I know more.

0reactions
luluhoccommented, Dec 18, 2022

It’s the same for me, i’ve made repro https://github.com/luluhoc/repro-atlas-pipeline-error

Read more comments on GitHub >

github_iconTop Results From Across the Web

(Sync AtlasError) Pipeline length greater than 50 not supported
I'm getting the below error for realm sync for both ios and android. Error: Failed to integrate download with non-retryable error: error ......
Read more >
MongoDB (AtlasError): Pipeline length greater than 50 not ...
So, I'm getting (AtlasError): Pipeline length greater than 50 not supported) when trying to update the record, the createMany and create works.
Read more >
Mongodb Atlas - pipeline length greater than 50 not supported
When i use mongoose for mongodb with an atlas mongo sever , it gives the error that mongo pipeline length greater than 50...
Read more >
Issues · prisma/prisma · GitHub
Command failed (AtlasError): Pipeline length greater than 50 not supported) kind/bug A reported bug. #15197 opened Sep 5, 2022 by johncblandii.
Read more >
Azure CosmosDB "pipeline not supported", MongoDB Atlas ...
Azure CosmosDB "pipeline not supported", MongoDB Atlas $lookup exceeds 16793600 bytes and Retool API request timeout is 2 minutes.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found