Skip to content

Does not work for me at all #20

Description

@guidoffm

I have tried a simple AWS Lambda that executes a query against AppSync to return data and also tried a query that invokes a mutation to add new data.

For both the query just returns null

But there are no error messages displayed.

AWS cloudwatch reads:

67548b14-2c8e-40fa-8437-ca2e79c00cbd GraphQL Query: query MyQuery {
  listGuido1S {
    items {
      id
      name
    }
  }
}
, Operation: null, Variables: 
{}

Interesting: Operation is always null.

The code I use is:

import AppsyncClient from 'appsync-client';
import gql from "graphql-tag";


export async function handler(evt: any, ctx: any) {

//     const query = gql(`
// mutation MyMutation($x: CreateGuido1Input!) {
//     createGuido1(input: $x ) {
//         name
//         id
//     }
// }
// `);

const query = gql(`
query MyQuery {
    listGuido1S {
      items {
        id
        name
      }
    }
  }
  `);

    const client = new AppsyncClient({
        apiUrl: process.env.API_URL
    });

    try {
        const res = await client.request({
            query: query,
            variables: {}
        });

        return res;
    } catch (err) {
        console.error('error: ', err);
        throw (err);
    }

}

The operations succeed when invoked via AWS console.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions