Is `/graphiql` not compatible with Prisma? I can e...
# orm-help
i
Is
/graphiql
not compatible with Prisma? I can execute queries and mutations fine (locally) but when I start adding filters, it just doesn’t work. When I hit the endpoint (`http://localhost:4466/service/stage`), where service and stage are my project’s service and stage, everything works perfectly but I have no idea where the data is going.
I’d rather have full access to my data, database(s), and everything else while still being able to leverage the power from Prisma
To clarify, I am aware that the database is a MySQL instance running in Docker. Just wondering if there is a way to run Prisma without Docker?
If there isn’t a way to do that, how do I get full control for production?
n
the database is a MySQL instance running in Docker
you can connect Prisma (running in Docker) to any MySQL Database (running in Docker or somewhere else).
Is
/graphiql
not compatible with Prisma?
I don't understand this question.
I can execute queries and mutations fine (locally) but when I start adding filters, it just doesn’t work.
Can you elaborate what adding filters means here? I feel like I'm missing something 🙂
i
Suppose I have the schema:
Copy code
type Post {
  id: ID! @unique
  createdAt: DateTime!
  updatedAt: DateTime!
  published: Boolean!
  title: String
  body: String!
  slug: String!
  author: User
}
If I try to execute the following query, I don’t actually get any filtered results. I get all posts, regardless of the
where
clause. Same thing goes for
skip
,
first
,
last
, etc
Copy code
{
  posts(where: { published: false }) {
    id
    title
    published
  }
}
n
Where are you running this query against
against your GraphQL Server or against the Prisma API directly?
i
I can only run those queries in the port that Docker exposes and maps Prisma to. I was wondering if I have the ability to have full control over everything (outside of Docker) but still have
skip
,
where
, etc
My GraphQL server. The link is above if the code helps
n
Ok. You are likely hitting this problem: https://github.com/graphcool/prisma-binding/issues/73
i
I don’t get any errors like shown in that issue. Let me try to downgrade
graphql-tools
n
It's not about any errors
ok hold on
you said you send your queries to your GraphQL Server
i
Yes
n
i
I thought
schema.graphql
was an extra schema to only expose to clients or to use in conjunction with
datamodel.graphql
(which is in root and has posts)
n
schema.graphql
is your GraphQL Server schema. If you successfully run a
posts
query, and your GraphQL Server uses the
schema.graphql
in your repository, this means you are not running it against the GraphQL Server but against your Prisma API directly.
i
Ahh
So, I have to write everything in a single file?
n
I don't know what you're trying to accomplish.
i
Basically, running everything locally, connecting to my local database, etc, but still using the APIs you expose, such as
where
,
last
,
first
, etc
Without dealing with Docker
n
You need Docker to run Prisma locally.
i
Okay
So when I push to prod, do I need to push a Docker instance of Prisma up with my API to run it?
n
Prisma is a component in your infrastructure. A typical stack includes a GraphQL Server, Prisma, and a database.
i
Local stuff isn’t that much of a deal to me. However, it’s free to run locally so I’m trying to figure out how everything works together before I ship. I could do this in prod but I’d have servers/databases/containers/etc running and probably ranking up a healthy bill for myself. I also wouldn’t be able to iterate as fast on trying to figure out what works and doesn’t. So, the main goal is prod but I’m doing everything locally because it’s free, if that makes sense
n
Deploying Prisma is usually done by deploying its Docker image.
i
Okay
And I can do that to AWS?
Or does it have to be Prisma Cloud?
n
It's just that you're talking about three different questions in this thread at the same time, so it's quite difficult to keep track of the conversation 🙂
i
Haha, sorry man
n
You can deploy Prisma anywhere where you can deploy Docker. For example Kubernetes, AWS, Digital Ocean
i
Cool. I’ll figure out this issue with filtering and hopefully ship tomorrow. Thanks man!
n
sure! 🙂 if you have another question let's hear it
i
So, let’s say I want to have authentication in my schema. If I put it in my
datamodel.graphql
, Prisma will generate mutations like
createAuthentication(...)
and queries like
authentications {}
. Obviously, I’d rather have a mutation called
login()
and a query called
me
. So, I put that in
src/schema.graphql
and merge the type definitions into the schema. Everything else is within
datamodel.graphql
. How would I properly do all of this? Would I add everything to a single GraphQL file (
datamodel.graphql
), split it up like I have, or?
Going based off of
<http://github.com/iamclaytonray/nest-prisma|github.com/iamclaytonray/nest-prisma>
n
I think the best way to get familiar with this kind of workflow is the boilerplate project: https://github.com/graphql-boilerplates/node-graphql-server/tree/master/advanced
schema.graphql
is completely free form. In your resolvers, you are implementing the mapping to your Prisma API.
i
Ahhh, I think I get it
So do I have to hand-write every mutation, query, and subscription within
schema.graphql
?
And just import the types from
datamodel.graphql
?
n
Yes.
i
Okay, I’m fine with that
For `input`s, do I have access to those within
schema.graphql
?
n
you need to import the type.
i
Thanks!