Don't expose GraphQL Playground
See original GitHub issueAs discussed in this Slack conversation, it is currently possible to access a GraphQL Playground that exposes a CRUD GraphQL API when using Prisma. To do so, you need to enable the info
log level in the PrismaClient
instructor and navigate your browser to the URL that’s printed like this:
prisma:info Started http server on 127.0.0.1:37157
On tools like Codesandbox this open port is also recognized, and offered to users by default to open a browser with that:
Since GraphQL is an implementation detail of Prisma 2.0, I believe we should not expose the GraphQL Playground.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:2
- Comments:8 (4 by maintainers)
Top Results From Across the Web
Why You Should Disable GraphQL Introspection In Production
While we don't often use introspection directly, it's important for tooling and GraphQL IDEs like Apollo Studio, GraphiQL, and Postman.
Read more >GraphQL is not meant to be exposed over the internet
You might be thinking that your GraphQL API is not really exposed. It's used on your website, but you don't show the playground...
Read more >Keeping certain parts of your GraphQL schema hidden from ...
Chances are your schema contains some Types, Fields, Queries, Mutations, etc, that you do not want the world to see or know about....
Read more >Building a GraphQL API in Go using gqlgen | by Jigar - Servian
For now, all we can do is create to dos — we still don't know how though. Now, let's create an implementation of...
Read more >Connect to Your StepZen GraphQL API
It's important that you do not expose your API key publicly. ... Follow the steps below to set up GraphQL Playground to connect...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@ansarizafar @peteralbert @homoky @Fonz001 and others interested in using the GraphQL Playground,
It is important to understand that Prisma2 does not provide a GraphQL server. Instead, what you are seeing is an internal implementation detail that currently looks very much like GraphQL. It is not actually compliant GraphQL and it will most certainly change in the future to be even less GraphQL compliant. The right way to think about this is as the internal wire protocol between the query engine and Prisma Client.
What we will do now: keep the modified GraphQL playground, but hide it by default. You will have to set an environment variable to access it.
What you should do now: you can keep using at as before, but please understand that it will break in small unexpected ways in the future because it is an undocumented implementation detail. The following are suggestions for how you could deal with various use cases where you might currently be relying on the modified GraphQL Playground:
Replacing the undocumented GraphQL Playground
Powerful data access: If you are using the GraphQL playground because Prisma Studio is not powerful enough for you, you should open feature requests. We intend for Studio to be a very flexible and powerful data management UI, and we would appreciate your suggestions.
Automatically generate data mutations: If you are relying on the GraphQL endpoint to programmatically generate a lot of mutations to create data, either for seeding a database or fulfil some complex workflow, you should adopt Prisma Client. Prisma Client is a type-safe data access library that has been designed to simplify tasks like this. If you are not using JavaScript/TypeScript or Go, then you should reconsider if Prisma is the right tool for you.
Building a GraphQL API: If you are using the internal and undocumented Prisma 2 GraphQL endpoint to build a GraphQL API, then you should really strongly consider to change direction. This is unsupported and will not be a happy journey for you. Instead you should investigate Nexus, which represents the culmination of 4 years of our experience building database-backed GraphQL APIs
I hope this helps shed some light on our decision.
Internal Note: the playground route should be dependant on an env var. We will add this env var to our local
.envrc