awslabs / aws-mobile-appsync-sdk-js

JavaScript library files for Offline, Sync, Sigv4. includes support for React Native
Apache License 2.0
920 stars 266 forks source link

Call to query fails without any error or result #581

Closed JohnAtFenestra closed 4 years ago

JohnAtFenestra commented 4 years ago

I am at a loss to understand what's happening. Using AppSync client in Vue.

I have a simple piece of code which worked yesterday:

  async function signIn(username, password) {
    const client = require('./aws.js').client
    console.log('------------ Entering signIn')
    const loginQuery = gql`
      query signIn($username: ID!, $password: ID!) {
        signIn(username: $username, password: $password, expiresInSecs: 1) {
...fields omitted as irrelevant
      }
    `

    const query = {
      query: loginQuery,
      variables: {
        username: username,
        password: password
      },
      fetchPolicy: 'no-cache'
    }
    try {
      console.log('before client query')
      console.log(client)
      const res = await client.query(query)
// NEVER REACHES THIS LINE. NO CONSOLE ERRORS. NO NETWORK ACTIVITY.
      console.log('after client query')
      console.log(res)
      const userData = await res.data.signIn
      user.setUser(userData, username)
      return {
        username,
        ...userData
      }
    } catch (e) {
      console.error(e)
    }
  }

I have tried restarting the local server. I have verified that the AppSync endpoint connects. I have verified that client is loading properly.

Where do I go from here?