Skip to content

Unable to get photon working. No error / Engine has already been stopped #912

Closed

Description

@chrisdrackett

I've migrated from prisma 1 to prisma 2 and I'm trying to test things out. So far I've been unable to add or read data from my database.

I'm able to confirm the database is setup correctly and has the correct tables, but if I try and add data via javascript with photon I don't get data or an error:

export const photon = new Photon({ log: true, __internal: { debug: true } })

const testConnection = async () => {
  console.log('> Testing...')
  await photon.connect()
  console.log('connected!')
  const checkIn = await photon.checkIns.findOne({ where: { id: '123' } })
  console.log('Query Complete!')
}

The output from the above is:

> Testing…
connected!

without errors or any other info.

I then tried to connect to the server at localhost:4000 and try and do a simple API call. I get the following:

Engine has already been stopped

This is with the following code:

export const UserQuery = extendType({
  type: 'Query',
  definition: (t) => {
    t.field('me', {
      type: 'User',
      nullable: true,
      resolve: async (_parent, _args, { photon, userId }) => {
        return await photon.users.findOne({ where: { id: userId } })
      },
    })
  },
})

Lastly I've tried to add data via studio. After entering the required fields for a User and pressing save I get:

Cannot set property 'createdAt' of undefined. I've opened an issue on this here: prisma/studio#277

At this point I'm not sure on next steps or how to debug.

Activity

  1. pantharshit00 commented on Nov 13, 2019

    @pantharshit00
    Contributor

    Hi,

    I was unable to reproduce this. Do you mind sharing your code in a git repository so that I can try to reproduce this using it?

  2. added
    bug/0-unknown
    kind/bug
    on Nov 13, 2019
  3. chrisdrackett commented on Nov 13, 2019

    @chrisdrackett
    Author
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug/0-unknownkind/bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions