Thanks for this great into to new Next js server graphql! I did run into an issue while following along but started with a typescript base in Next and not iust plain js. My graphql.js route created errors and would not come up. Here is the FIX: The fix was to use the common js "Require" syntax verses "Import" syntax. So at top of the graphql.js file (note I did not use the .ts extension following just your tutorial and plain js) The import as you illustrated " import ApolloServer, { gql } from "apollo-server-micro"; " did not work and deep errors. After much looking around I thought it may need the "Require" syntax instead. Trying " const { ApolloServer, gql } = require('apollo-server-micro'); " instead, to my surprise, it worked! Hope that helps anyone who has typescript installed in their Next JS. Look forward to more teaching from you!
Thanks for the tutorial! I am encountering an issue with the deployment. It seems like vercel cannot get connected to the Heroku's postgresql 20:47:54.795 Error: self signed certificate 20:47:54.795 at TLSSocket.onConnectSecure (_tls_wrap.js:1501:34) 20:47:54.795 at TLSSocket.emit (events.js:315:20) 20:47:54.795 at TLSSocket._finishInit (_tls_wrap.js:936:8) 20:47:54.795 at TLSWrap.ssl.onhandshakedone (_tls_wrap.js:710:12) How do you do your deployment?
When deploying to Zeit (Vercel) it throws an error saying it has more than 12 serverless functions which is the limit per repository. is It right or am I missing something?
Hey Evandro! Great question... it seems like Now has a limit of 12 serverless functions per deployment on a Hobby account (vercel.com/docs/v2/platform/limits#general-limits)... that said, I don't quite know what that means, so I started a question on their Spectrum channel to try to find out some additional details. Stay tuned to this page to see what they reply with: spectrum.chat/zeit/general/serverless-functions-per-deployment-limit~8172db36-096d-4ab1-a6de-2f3bf6893341
reduce the number of files in pages folder, all files without "_" prefix are all public by default (included /pages, /pages/api). I move those files which doesn't need getInitialProps/getServerSideProps to folders outside of pages
I'm using CRA and I have a backend directory where I setup my ApolloServer, PrismaClient and connect to my DB. On the frontend I just hooked up ApolloClient to my graphql endpoint and everything works. How would I go about using ApolloClient here with NextJS? Also, could I just move my backend directory into the root directory of my NextJS app?
Excellent video. May i know if we can use apollo-server-express instead of apollo-server-micro? What's the difference between the two? Can i use type-graphql with them? Thanks
apollo-server-micro is now deprecated. apollo-server is the plain GraphQL server Apollo is providing. apollo-server-express is used to integrate with your already existing express backend. But here API routes are in the NextJS server, so using that will be an overhead for the bundlesize
THE best GraphQL tutorial video I've seen. Ever. Very well explained. Keep up the good work 👍🏻
Thanks, Arsam!!
Truly best
Exactly what I needed for my project, thanks!
You explained this really simply and succinctly but also with enough detail that the nuance of why you were doing things didn’t get lost. Thanks!
Thanks for this great into to new Next js server graphql!
I did run into an issue while following along but started with a typescript base in Next and not iust plain js. My graphql.js route created errors and would not come up. Here is the FIX:
The fix was to use the common js "Require" syntax verses "Import" syntax. So at top of the graphql.js file (note I did not use the .ts extension following just your tutorial and plain js)
The import as you illustrated " import ApolloServer, { gql } from "apollo-server-micro"; " did not work and deep errors.
After much looking around I thought it may need the "Require" syntax instead. Trying " const { ApolloServer, gql } = require('apollo-server-micro'); " instead, to my surprise, it worked!
Hope that helps anyone who has typescript installed in their Next JS. Look forward to more teaching from you!
Nice! I found that,
import { gql, ApolloServer } from "apollo-server-micro";
also works for typescript next js :)
I'm building a GraphQL app right now. Really helpful.
Thanks, nice tutorial. What color theme you use? It's a nice theme.
Thanks!
Thanks for the tutorial! I am encountering an issue with the deployment. It seems like vercel cannot get connected to the Heroku's postgresql
20:47:54.795 Error: self signed certificate
20:47:54.795 at TLSSocket.onConnectSecure (_tls_wrap.js:1501:34)
20:47:54.795 at TLSSocket.emit (events.js:315:20)
20:47:54.795 at TLSSocket._finishInit (_tls_wrap.js:936:8)
20:47:54.795 at TLSWrap.ssl.onhandshakedone (_tls_wrap.js:710:12)
How do you do your deployment?
This video was excellent, does anyone have any recommendations on how to add mutations to this project? like how would I post stuff to the server?
shout out to Leigh for getting on LogRocket!
Thanks very much, Chris :)
Great video!
How do you host this if you want NextJS on a CDN and the backend on some server?
What vscode theme are you using?
When deploying to Zeit (Vercel) it throws an error saying it has more than 12 serverless functions which is the limit per repository. is It right or am I missing something?
Hey Evandro! Great question... it seems like Now has a limit of 12 serverless functions per deployment on a Hobby account (vercel.com/docs/v2/platform/limits#general-limits)... that said, I don't quite know what that means, so I started a question on their Spectrum channel to try to find out some additional details. Stay tuned to this page to see what they reply with: spectrum.chat/zeit/general/serverless-functions-per-deployment-limit~8172db36-096d-4ab1-a6de-2f3bf6893341
reduce the number of files in pages folder, all files without "_" prefix are all public by default (included /pages, /pages/api). I move those files which doesn't need getInitialProps/getServerSideProps to folders outside of pages
I'm using CRA and I have a backend directory where I setup my ApolloServer, PrismaClient and connect to my DB. On the frontend I just hooked up ApolloClient to my graphql endpoint and everything works. How would I go about using ApolloClient here with NextJS? Also, could I just move my backend directory into the root directory of my NextJS app?
Excellent video. May i know if we can use apollo-server-express instead of apollo-server-micro? What's the difference between the two? Can i use type-graphql with them? Thanks
apollo-server-micro is now deprecated. apollo-server is the plain GraphQL server Apollo is providing. apollo-server-express is used to integrate with your already existing express backend. But here API routes are in the NextJS server, so using that will be an overhead for the bundlesize
soo will it work on apache server?
Could you make a video on ApolloClient and NextJS please.
Nice Please can you do for mongodb?
Too small letters please zoom it
bro you can increase it easily tough =). Hone you have done this amazing tutorial
javascript is so messy...
Thanks!