Git Product home page Git Product logo

Comments (4)

auBusinessDaD avatar auBusinessDaD commented on June 2, 2024

I had thought it was something to do with the Apollo or cache, but even when I spin up brand new implementations it still doesn't like it.

from pup.

cleverbeagle avatar cleverbeagle commented on June 2, 2024

When do you see the 400 error? Automatically on server startup or only when making requests? If only when making requests, double-check the arguments for the query match in your schema as well as on the client (e.g., is an arg required in the schema but not in the client).

Something like:

// Schema

type Query {
  someQuery(requiredArg: String!): Stuff
}

// Client

query someQuery($requiredArg: String) { // Notice that String is not marked as required here.
  someQuery(requiredArg: $requiredArg) {
    field
  }
}

Also worth making sure that in your startup/client/apollo.js file, in the onError callback, you're logging out all of the errors (sometimes an error gets burried here that's helpful for debugging). For example:

onError(({ graphQLErrors, networkError }) => {
    if (graphQLErrors) {
    graphQLErrors.map(({ message, locations, path }) => {
      console.log(message);
    });
    }

    if (networkError) {
      console.log(networkError);
    }
}),

from pup.

auBusinessDaD avatar auBusinessDaD commented on June 2, 2024

Get no notifications in the terminal that there is an issue. Only get the issue when I go to a page that uses the call - so it doesn't load and the console shows the following error;
image

----from api\Users\types.js
type Friends {
    userId: String
    username: String
  }

type User {
    _id: String
    name: Name
    username: String
    emailAddress: String
    oAuthProvider: String
    roles: [Role]
    itchlist: [String]
    wishlist: [String]
    ownlist: [String]
    friends: [Friends]
    subscription: String
    subscriptionId: String
    gamePlayCounts: [GamePlayCount],
    loanedTo: [LoanedTo]
    borrowedFrom: [BorrowedFrom]
    settings: [UserSetting] # From /api/UserSettings/types.js
  }

----from ui\queries\Users.gql----
query userFromUsername($username: String) {
  userFromUsername(username: $username) {
    ...UserAttributes,
      username
      wishlist
      itchlist
      ownlist
      subscription
      friends {
        userId
        username
      }
      loanedTo {
        _id
        userId
        username
      }
      borrowedFrom {
        _id
        userId
        username
      }
      gamePlayCounts {
        _id
        count
      }
  }
}

As for Apollo, that does have an error link - but I don't see anything in the console whent he error occurs (just in the browser console/dev tools)

const errorLink = onError(({ graphQLErrors, networkError }) => {
  if (graphQLErrors)
    graphQLErrors.map(({ message, location, path }) =>
      console.log(`[GraphQL error]: Message: ${message}, Location: ${location}, Path: ${path}`),
    );

  if (networkError) console.log(`[Network error]: ${networkError}`);
});

from pup.

auBusinessDaD avatar auBusinessDaD commented on June 2, 2024

OH... MY... GOH!!

Turns out, I am just an idiot. The issue was not with my code. Everything was right - and I could see that in the above. BUT, and wait for the face palm, because I am using docker images sitting side by side for the real site and the dev site I change some settings manually AND this is where the rub is. YES, I changed the code correctly and even got everything looking sexy (even though I couldn't yet see it) BUT the dev site was still looking at the live site containers gql (instead of the dev gql).

I will put some s=time into automating that deployment to docker... I am loving Docker to manage it all, but manually handling the dev to live push (by manually changing 2 values is a risk of my stupidity seeping in....)

from pup.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.