Error with Prisma Yoga server


Hello, I am trying to set up a new project with NextJs, Typescript and Prisma Yoga graphql server based on this repo
I added an addBillingAddress Mutation with the following resolver:

async addBillingAddress(
    { Moltin }
  ) {
    try {
      const { data: address } = await Moltin.Addresses.Create({
        customer: customerId,
        body: {
          first_name: firstName,
          last_name: lastName,
          line_1: addressLine,
          postcode: postalCode,
          county: region,

      return address;
    } catch (e) {
      return e;

The error I’m getting when submitting the form that uses this mutation is "Cannot return null for non-nullable field BillingAddress.first_name."
The mutation looks like this:

    const ADD_BILLING_ADDRESS = gql`
      mutation addBillingAddress(
        $customerId: ID!
        $firstName: String!
        $lastName: String!
        $addressLine: String!
        $postalCode: String!
        $region: String!
        $country: String!
      ) {
          customerId: $customerId
          firstName: $firstName
          lastName: $lastName
          addressLine: $addressLine
          postalCode: $postalCode
          region: $region
          country: $country
        ) {

I tried a lot of different ways to ask for the data but error is always there. Anyone can help indicating which direction I should look?


Never mind, I figured it out :grinning:
Ended up being the country field being sent as the entire country name instead of the 2 digit code.
Pro tip: Make sure you have a way to debug your backend and don’t take graphql errors literally :grin:


Great! It’s awesome to see you’re using GraphQL.

@jonathan and I recorded a video on GraphQL which will be doing out this week where we share some of the interesting things you can do with GraphQL + Moltin.

I’ll drop you a message when it’s online in case it’s of any use :smile:


:+1: Absolutely, please let me know! I think I will have to do quite some work with GraphQL in the following months and I hope plugging in Moltin proves successful too! All resources are very welcome :slight_smile:


Sounds great @proko!

Here is the video

We’ve another coming on Gatsby and further videos/examples using GraphQL :wink: