deep-foundation / deeplinks

https://discord.gg/deep-foundation
The Unlicense
14 stars 9 forks source link

ApolloError: TextDecoder is not defined #168

Open Konard opened 1 year ago

Konard commented 1 year ago
  ● client › { id: { _id: ['@deep-foundation/core', 'Package'] } }

    ApolloError: TextDecoder is not defined

      at new ApolloError (node_modules/@apollo/client/errors/index.js:29:28)
      at node_modules/@apollo/client/core/QueryManager.js:657:19
      at both (node_modules/@apollo/client/utilities/observables/asyncMap.js:16:53)
      at node_modules/@apollo/client/utilities/observables/asyncMap.js:9:72
      at Object.then (node_modules/@apollo/client/utilities/observables/asyncMap.js:9:24)
      at Object.error (node_modules/@apollo/client/utilities/observables/asyncMap.js:17:49)
      at notifySubscription (node_modules/zen-observable/lib/Observable.js:140:18)
      at onNotify (node_modules/zen-observable/lib/Observable.js:179:3)
      at SubscriptionObserver.error (node_modules/zen-observable/lib/Observable.js:240:7)
      at node_modules/@apollo/client/utilities/observables/iteration.js:4:68
          at Array.forEach (<anonymous>)
      at iterateObserversSafely (node_modules/@apollo/client/utilities/observables/iteration.js:4:25)
      at Object.error (node_modules/@apollo/client/utilities/observables/Concast.js:37:21)
      at notifySubscription (node_modules/zen-observable/lib/Observable.js:140:18)
      at onNotify (node_modules/zen-observable/lib/Observable.js:179:3)
      at SubscriptionObserver.error (node_modules/zen-observable/lib/Observable.js:240:7)
      at handleError (node_modules/@apollo/client/link/http/parseAndCheckHttpResponse.js:117:67)
      at node_modules/@apollo/client/link/http/parseAndCheckHttpResponse.js:126:40
Konard commented 1 year ago
const { gql } = require("@apollo/client");
const { generateApolloClient } = require("@deep-foundation/hasura/client");

const apolloClient = generateApolloClient({
  path: `3006-deepfoundation-dev-d3lwbampmxc.ws-eu96b.gitpod.io/gql`,
  ssl: true,
  secret: 'myadminsecretkey',
  ws: true
});

const fn = async() => {
  const result = await apolloClient.query({ query: gql`query {links{id}}`})
  console.dir(result);
}
fn();

Using node test.js command it just works. But if run the same code inside tests, it gives ApolloError: TextDecoder is not defined

Konard commented 1 year ago

Screenshot_20230510_131129