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.

Prisma Client is unable to fetch DateTime lists

See original GitHub issue

Bug description

Prisma Client is unable to fetch DateTime lists

How to reproduce

Use this schema:

generator client {
  provider = "prisma-client-js"
}

datasource ds {
  provider = "postgresql"
  url      = "postgresql://siddhant@localhost:5432/experiments" // Replace
}

model User {
  id Int @id

  dateTimeList DateTime[]
}

& use this script:

import { PrismaClient } from "@prisma/client";

const prisma = new PrismaClient();

const main = async () => {
  await prisma.user.create({
    data: {
      id: 1,
      dateTimeList: {
        set: [
          new Date().toISOString(),
          new Date().toISOString(),
          new Date().toISOString(),
        ],
      },
    },
  });

  console.log(
    await prisma.user.findMany({
      where: {
        id: 1,
      },
    })
  );
};

main()
  .catch(async (e) => console.log(e))
  .finally(async () => {
    await prisma.$disconnect();
  });

The output of this script is:

[ { id: 1, dateTimeList: Invalid Date } ]

Expected behavior

Expected output:

[ { id: 1, dateTimeList: [

   "2020-09-03T20:28:05.886Z"
   "2020-09-03T20:28:05.886Z",
   "2020-09-03T20:28:05.886Z"
] } ]

Actual data in the DB seems to be correct AFAICT: Screenshot 2020-09-03 at 22 30 41

Environment & setup

  • OS: macOS
  • Database: PostgreSQL
  • Node.js version: v12.16.3
  • Prisma version:
@prisma/cli          : 2.6.1
Current platform     : darwin
Query Engine         : query-engine 6a8054bb549e4cc23f157b0010cb2e95cb2637fb (at node_modules/@prisma/cli/query-engine-darwin)
Migration Engine     : migration-engine-cli 6a8054bb549e4cc23f157b0010cb2e95cb2637fb (at node_modules/@prisma/cli/migration-engine-darwin)
Introspection Engine : introspection-core 6a8054bb549e4cc23f157b0010cb2e95cb2637fb (at node_modules/@prisma/cli/introspection-engine-darwin)
Format Binary        : prisma-fmt 6a8054bb549e4cc23f157b0010cb2e95cb2637fb (at node_modules/@prisma/cli/prisma-fmt-darwin)
Studio               : 0.272.0

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

2reactions
sdntscommented, Oct 30, 2020

Just tried this, and it seems to be working as expected now, closing!

1reaction
pantharshit00commented, Oct 16, 2020
Read more comments on GitHub >

github_iconTop Results From Across the Web

Prisma Client is unable to fetch DateTime lists · Issue #3517
Bug description Prisma Client is unable to fetch DateTime lists How to reproduce Use this schema: generator client { provider ...
Read more >
Prisma Client API (Reference)
Lets you order the returned list by any property. select, UserCountAggregateInputType, No, Select which fields to count (non- null values) - you can...
Read more >
Prisma 2 unable to fetch DateTime column with null value
At the fee_start_month column, some of the values are null so prisma2 unable to fetch those records, and It's thrown an exception. Generated ......
Read more >
How to Build a Fullstack App with Next.js, Prisma, and ...
Before you can access your database from Next.js using Prisma, you first need to install Prisma Client in your app. You can install...
Read more >
End-to-end type safety with Next.js, Prisma, and GraphQL
npm install graphql nexus graphql-scalars @prisma/client ... a lightweight library that provides React Hooks for handling data fetching.
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