awslabs / aws-mobile-appsync-sdk-js

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

aws-appsync-auth-link directly imports graphql but does not declare a dependency on it #714

Open rally25rs opened 2 years ago

rally25rs commented 2 years ago

Note: If your issue/feature-request/question is regarding the AWS AppSync service, please log it in the official AWS AppSync forum

Do you want to request a feature or report a bug? bug

What is the current behavior? the aws-appsync-auth-link and aws-appsync-subscription-link packages directly import graphql https://github.com/awslabs/aws-mobile-appsync-sdk-js/blob/master/packages/aws-appsync-auth-link/src/auth-link.ts#L6

However package.json does not list graphql as a dependency, so it is not allowed to be imported when using a "strict" package manager like Yarn PnP

    Cannot find module 'graphql/language/printer' from '/Users/jvalore/Projects/ui/.yarn/__virtual__/aws-appsync-auth-link-virtual-6a00cc157f/0/cache/aws-appsync-auth-link-npm-3.0.7-6a8f1c0baa-0626782710.zip/node_modules/aws-appsync-auth-link/lib'

    Require stack:
      .yarn/__virtual__/aws-appsync-auth-link-virtual-6a00cc157f/0/cache/aws-appsync-auth-link-npm-3.0.7-6a8f1c0baa-0626782710.zip/node_modules/aws-appsync-auth-link/lib/auth-link.js
      .yarn/__virtual__/aws-appsync-auth-link-virtual-6a00cc157f/0/cache/aws-appsync-auth-link-npm-3.0.7-6a8f1c0baa-0626782710.zip/node_modules/aws-appsync-auth-link/lib/index.js
      .yarn/__virtual__/aws-appsync-subscription-link-virtual-ba95336bef/0/cache/aws-appsync-subscription-link-npm-3.0.9-5e69de215e-f24ec4bcb3.zip/node_modules/aws-appsync-subscription-link/lib/realtime-subscription-handshake-link.js
      .yarn/__virtual__/aws-appsync-subscription-link-virtual-ba95336bef/0/cache/aws-appsync-subscription-link-npm-3.0.9-5e69de215e-f24ec4bcb3.zip/node_modules/aws-appsync-subscription-link/lib/index.js

If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem.

try to use aws-appsync-auth-link in a modern Yarn PnP project and you will get the above error.

What is the expected behavior?

This package should list graphql in it's package.json dependencies since it is required.

Which versions and which environment (browser, react-native, nodejs) / OS are affected by this issue? Did this work in previous versions?

aws-appsync-auth-link@3.0.7