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.

The prisma-binding to SDL-first guide is missing really crucial info

See original GitHub issue

Hello,

While going through this page https://www.prisma.io/docs/guides/upgrade-guides/upgrade-from-prisma-1/upgrading-prisma-binding-to-sdl-first I had a few questions that nobody is answering on the Slack channel, here they are:

1- The first step requires that I download the full graphql schema from the graphql server. The confusion here is that this guide assumes that we have gone through multiple steps prior to that, like fixing schema incompatibilities. But if that step has already been done then there would be no running graphql server, so how exactly should we get the updated graphql schema?

2- The last step (section 4.2) says this:

You can also delete any remaining .js files, the schema.graphql and prisma.graphql files.

If I delete the schema.graphql file, then how would the server work?


const server = new GraphQLServer({
  typeDefs: 'src/schema.graphql',      // see this line ???
  resolvers,
  context: req => ({
    ...req,
    prisma: new PrismaClient()
  }),

I tried deleting it, but the grapqhl server won’t run in reality, and I don’t think it should be removed otherwise I’m missing something here.

3- If generated schema and application schema have been combined into one, then this means all operations supported will be exposed. Which introduces a lot of security issues that we never had to deal with. but like this we’re forced to. What should we do in this case?

4- After the upgrade is done, what is the recomeneded workflow? what are the required steps to add a new feature? Are we stuck with editing a 24k lines long file?

Issue Analytics

  • State:open
  • Created 3 years ago
  • Comments:10 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
nikolasburkcommented, Mar 3, 2021

I’m lost now honestly. The article says that we have to download the full schema, and that is the purpose of the download button in the playground:

In this case, “full schema” means: application schema where the imported types are already part of the schema as opposed to before where the application schema imported the types from the Prisma GraphQL schema. Does that make more sense?

Basically this is the schema before with graphql-import:

image

And this is the “full schema” without using graphql-import that you have to use with Prisma 2:

image

1reaction
nikolasburkcommented, Mar 2, 2021

Hey @omar-dulaimi, thanks a lot for raising these points! I’ll try to address them as good as possible but I’d also like to offer you to jump on a call to discuss this in person 🙂 I’ll reach out to you in a DM on Slack to coordinate this in case you’re interested!

1- The first step requires that I download the full graphql schema from the graphql server. The confusion here is that this guide assumes that we have gone through multiple steps prior to that, like fixing schema incompatibilities. But if that step has already been done then there would be no running graphql server, so how exactly should we get the updated graphql schema?

Hmm, did you already shut down the GraphQL server that you had with Prisma 1? What’s needed here indeed is a GraphQL schema of your previous GraphQL server so that the same API can be replicated with Prisma 2.

If I delete the schema.graphql file, then how would the server work?

Ha, thanks for catching this! I think this indeed a false instruction that wrongfully made it into this guide! I just removed it via this PR.

If generated schema and application schema have been combined into one, then this means all operations supported will be exposed. Which introduces a lot of security issues that we never had to deal with. but like this we’re forced to. What should we do in this case?

I’m not sure I can follow… can you elaborate what exactly you mean and maybe give an example? If you’re worried about authorization, then a library like graphql-shield might be a good idea to include. However, if you didn’t use it in your setup before I don’t think it will be necessary now.

4- After the upgrade is done, what is the recomeneded workflow?

Again I’m not fully sure what you mean, maybe you can elaborate? Generally, a workflow to add a feature would be:

  1. adjust Prisma data model
  2. adjust GraphQL schema definition
  3. implement GraphQL resolvers functions

I hope this helps already, but as I said I’ll reach out to you on Slack so that we can jump on a call and hopefully clarify these questions! 🙏

Read more comments on GitHub >

github_iconTop Results From Across the Web

Upgrading from Prisma 1 with prisma-binding to SDL-first
This upgrade guide describes how to migrate a Node.js project that's based on Prisma 1 and uses prisma-binding to implement a GraphQL server....
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