Has anyone ran into issues with `serverless-bundle...
# help
j
Has anyone ran into issues with
serverless-bundle
and
aws-appsync
using a different version of graphql in their dependencies and causing the following error?:
Copy code
"errorMessage": "Cannot use n \"__Schema\" from another module or realm.\n\nEnsure that there is only one instance of \"graphql\" in the node_modules\ndirectory. If different versions of \"graphql\" are the dependencies of other\nrelied on modules, use \"resolutions\" to ensure only one version is installed.\n\n<https://yarnpkg.com/en/docs/selective-version-resolutions>\n\nDuplicate \"graphql\" modules cannot be used at the same time since different\nversions may have different capabilities and behavior. The data from one\nversion used in the function from another could produce confusing and\nspurious results."
This only started happening when I added
serverless-bundle
to leverage yarn/lerna workspaces. All my services work correctly outside of the couple that are using the
aws-appsync
libs which appear to be using a really old graphql version (0.13.0) whereas
serverless-bundle
is using version 15.5.1
I’ve tried no hoisting graphql but that hasn’t seemed to fix it
f
@Jay any ideas on this?
j
aws-appsync specifically is a pinned dependency to graphql 0.13.0 which seems odd considering it’s 4 years old and current one is 15.5.1
j
Hmm I’m not totally sure. I don’t think I’ve run into this before. Do you get this error when running
yarn
?
j
the error doesn’t happen when running yarn, though yarn does seem to be hoisting when it shouldn’t. The error is at runtime
j
Oh I see. Yeah not totally sure about it.
j
In case anyone else run into this, upgrading to Yarn 3.X and adding the following resolution seems to have resolved the issue. I haven’t completely testing everything yet but appears to be all good now
Copy code
"resolutions": {
    "graphql": "15.5.1"
  },