Unable to upgrade the @graphql-mesh on latest version, sdkRequesterFactory is causing some issue

310 views Asked by At

I am trying to update the @graphql-mesh with the latest version and the following is the related package needs to update

"@graphql-mesh/cache-file": "^0.8.23",
"@graphql-mesh/cache-inmemory-lru": "^0.6.18",
"@graphql-mesh/cache-redis": "^0.9.8",
"@graphql-mesh/cli": "^0.71.3",
"@graphql-mesh/config": "0.37.3",
"@graphql-mesh/graphql": "^0.26.2",
"@graphql-mesh/merger-stitching": "^0.15.52",
"@graphql-mesh/runtime": "^0.35.2",
"@graphql-mesh/transform-cache": "^0.12.13",

I did update the packages and after that, I got an unexpected error. I am not sure how can I replace the sdkRequester with sdkRequesterFactory in the latest version.

enter image description here

I tried a set of combinations to make it work but unfortunately no luck, below is the code which I am trying

import { getMesh } from '@graphql-mesh/runtime';
import { findAndParseConfig } from '@graphql-mesh/cli';

import { getSdk } from './__generated__/sdk'; 

async function load() {
  const meshConfig = await findAndParseConfig();
  const {sdkRequesterFactory, meshContext }= await getMesh(meshConfig);  
  const sdkRequester = sdkRequesterFactory(meshContext);
  const sdk = getSdk(sdkRequester);
  return sdk;
}

Here is the old version working copy

import { getMesh } from '@graphql-mesh/runtime';
import { findAndParseConfig } from '@graphql-mesh/config';

import { getSdk } from './__generated__/sdk';

async function load() {
  const meshConfig = await findAndParseConfig();
  const { sdkRequester } = await getMesh(meshConfig);

  const sdk = getSdk(sdkRequester);

  return sdk;
}

async function loadMesh() {
  try {
    const sdk = await load();
    return sdk;
  } catch (error) {
    console.error('createServiceBinding Error', error);
    throw new Error(`Mesh SDK Load error: ${error}`);
  }
}

export default loadMesh;
0

There are 0 answers