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

isPromise is not a function #360

Closed
alexfigliolia opened this issue Nov 11, 2021 · 3 comments
Closed

isPromise is not a function #360

alexfigliolia opened this issue Nov 11, 2021 · 3 comments

Comments

@alexfigliolia
Copy link

alexfigliolia commented Nov 11, 2021

I've run into an odd situation when using mutationWithClientMutationId. Anytime I attempt to run a mutation that triggers mutateAndGetPayload I'm getting the following response:

{
  "errors": [
    {
      "message": "(0 , _isPromise.default) is not a function",
      "locations": [
        {
          "line": 33,
          "column": 3
        }
      ],
      "path": [
        "addUser"
      ]
    }
  ],
  "data": {
    "addUser": null
  }
}

The mutation logic always runs successfully, but the responses to mutation queries are always this obscure error. I'm also finding that outputFields' resolve functions never run, even when specifically queried for.

Below is an example of one of the problematic mutations.

const addUser = mutationWithClientMutationId({
  name: 'addUser',
  inputFields: {
    name: {
      type: new GraphQLNonNull(GraphQLString),
      description: "A user's name",
    },
    email: {
      type: new GraphQLNonNull(GraphQLString),
      description: "A user's login email address"
    },
    password: {
      type: new GraphQLNonNull(GraphQLString),
      description: "A user's plain text password"
    }
  },
  outputFields: {
    user: {
      type: UserType,
      resolve: payload => {
        console.log('USER PAYLOAD', payload);
        return payload.user;
      }
    }
  },
  mutateAndGetPayload: async ({ name, email, password }) => {
    const { valid, message } = User.validatePassword(password);
    if (!valid) {
      throw new Error(message);
    }
    try {
      const user = await User.create({
        name,
        email,
        password,
      });
      return { user };
    } catch (error) {
      throw new Error(error);
    }
  }
});

I'm really curious if anyone has ran into this before because I cannot find anything out there on the web that resembles this issue. Any thoughts or guidance would be greatly appreciated

  • Alex
@chanind
Copy link

chanind commented Nov 26, 2021

I have this happen too when trying to use grahql v16. Using graphql v15 seems to work. It looks like this library is directly importing the isPromise method from the graphql library, but they must have changed how that method is exported in v16

@saihaj
Copy link
Member

saihaj commented Nov 26, 2021

This library currently doesn’t support graphql v16

@CoericK
Copy link

CoericK commented Dec 5, 2021

Same here, we upgraded to GraphQL v16.0.1, using graphql-relay 0.9.0 getting the same error:

"(0 , _isPromise.default) is not a function

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

4 participants