Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Recent Posts (GraphQL Slug Issue) #1

Open
GKozlowskiDesign opened this issue Aug 15, 2023 · 3 comments
Open

Recent Posts (GraphQL Slug Issue) #1

GKozlowskiDesign opened this issue Aug 15, 2023 · 3 comments

Comments

@GKozlowskiDesign
Copy link
Owner

Screen Shot 2023-08-15 at 7 33 12 PM

Not sure why this isn't working, it was working literally hours ago. I added new posts to the site and redeployed it and suddenly it stopped working. May remove it from the live site temporarily until I can find a way to fix it. Please help.

@pcampagnano
Copy link

pcampagnano commented Aug 17, 2023

https://github.com/gkozlowskidesign/GKDesign_Portfolio/blob/1b0d5d2a86d8e821230726bc249761d8b4fe6805/services/index.js#L240C1-L240C1

query GetPostDetails() { >> query GetPostDetails {

another one that will cause some issues:

https://github.com/gkozlowskidesign/GKDesign_Portfolio/blob/1b0d5d2a86d8e821230726bc249761d8b4fe6805/services/index.js#L187

query GetCategoryPost() { >> query GetCategoryPost {

graphql doesn't like empty args in ()

@GKozlowskiDesign
Copy link
Owner Author

@pcampagnano It worked, thank you! I will keep that in mind going forward. I am somewhat new to GraphQL and I've been doing a ton of AWS Amplify tutorials which build out serverless apps using GraphQL calls so this is actually helpful. Although originally this was working fine and I am still not getting any errors with my featured posts but I am going to change it regardless.

Solution
Removed Empty Args or Parenthesis

Question
1.) Do you know why it would work in the first place and then suddenly would cause errors?

2.) Does it have anything to do with my frequent redeploying or was this just bad practice do you think?

@pcampagnano
Copy link

For 1): https://stackoverflow.com/questions/52769993/how-to-correctly-declare-a-graphql-query-without-parameters

In the spec, https://spec.graphql.org/June2018/#sec-Language.Arguments

I couldn't find what implementation hygraph uses under the hood (and it looks closed source.) Apollo server behaves similarly I believe, though that exact error message doesn't show up in the repo in an obvious place.

Why it would work previously and then stop working, unless hygraph made changes to better adopt the graphql spec, or there was a deployment that was referencing different code when things worked, hard to say.

  1. Frequent deployments are great! The more the better - as you run into cases like this you can add in test coverage to ensure a deployment won't go out with the same bug. Eventually covering test cases pre-emptively will be the best way to go. While a comprehensive pipeline testing strategy including unit, integration, etc tests is best, you can easily get started with something like selenium running right out of your browser against staging deployments to make sure things render correctly and without error.

https://chrome.google.com/webstore/detail/selenium-ide/mooikfkahbdckldjjndioackbalphokd

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants