awslabs / aws-mobile-appsync-sdk-js

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

Getting apollo-link Type error on build #739

Closed slikk66 closed 1 year ago

slikk66 commented 1 year ago

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

What is the current behavior? breaking on yarn build

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

yarn build gives:

node_modules/apollo-link/lib/types.d.ts:5:18 - error TS2430: Interface 'ExecutionResult<TData>' incorrectly extends interface 'ExecutionResult<ObjMap<unknown>, ObjMap<unknown>>'.
  Types of property 'data' are incompatible.
    Type 'TData | null | undefined' is not assignable to type 'ObjMap<unknown> | null | undefined'.
      Type 'TData' is not assignable to type 'ObjMap<unknown> | null | undefined'.
        Type 'TData' is not assignable to type 'ObjMap<unknown>'.

5 export interface ExecutionResult<TData = {
                   ~~~~~~~~~~~~~~~

  node_modules/apollo-link/lib/types.d.ts:5:34
    5 export interface ExecutionResult<TData = {
                                       ~~~~~~~~~
    6     [key: string]: any;
      ~~~~~~~~~~~~~~~~~~~~~~~
    7 }> extends GraphQLExecutionResult {
      ~
    This type parameter might need an `extends ObjMap<unknown>` constraint.
  node_modules/apollo-link/lib/types.d.ts:5:34
    5 export interface ExecutionResult<TData = {
                                       ~~~~~~~~~
    6     [key: string]: any;
      ~~~~~~~~~~~~~~~~~~~~~~~
    7 }> extends GraphQLExecutionResult {
      ~
    This type parameter might need an `extends ObjMap<unknown> | null | undefined` constraint.

Found 1 error in node_modules/apollo-link/lib/types.d.ts:5

What is the expected behavior? build successfully

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

    "devDependencies": {
        "@types/aws-lambda": "^8.10.109",
        "@types/lodash": "^4.14.191",
        "@types/uuid": "^9.0.0",
        "aws-sdk": "^2.0.0",
        "typescript": "^4.9.4"
    },
    "dependencies": {
        "apollo-cache-inmemory": "^1.6.6",
        "autodetect-decoder-stream": "^2.0.2",
        "aws-appsync": "^4.1.9",
        "es6-promise": "^4.2.8",
        "graphql": "^16.6.0",
        "graphql-tag": "^2.12.6",
        "http": "^0.0.1-security",
        "isomorphic-fetch": "^3.0.0",
        "lodash": "^4.17.21",
        "reliance-private-survey-schema": "~1.4.0",
        "uuid": "^9.0.0",
        "ws": "^8.12.0"
    }

Just came back to build this project that has been working for a while, I am now getting this build error, I added back all packages in use with the newest versions.

Here are the warnings that get spit out during build:

[2/2] 🔨  Regenerating lockfile and installing missing dependencies...
warning " > apollo-cache-inmemory@1.6.6" has incorrect peer dependency "graphql@^0.11.0 || ^0.12.0 || ^0.13.0 || ^14.0.0 || ^15.0.0".
warning "apollo-cache-inmemory > apollo-cache@1.3.5" has incorrect peer dependency "graphql@^0.11.0 || ^0.12.0 || ^0.13.0 || ^14.0.0 || ^15.0.0".
warning "apollo-cache-inmemory > apollo-utilities@1.3.4" has incorrect peer dependency "graphql@^0.11.0 || ^0.12.0 || ^0.13.0 || ^14.0.0 || ^15.0.0".
warning " > aws-appsync@4.1.9" has incorrect peer dependency "graphql@0.13.0 || 14.x || 15.0.0 - 15.3.0".
warning "aws-appsync > @aws-sdk/lib-storage@3.245.0" has unmet peer dependency "@aws-sdk/abort-controller@^3.0.0".
warning "aws-appsync > apollo-cache-inmemory@1.3.12" has incorrect peer dependency "graphql@0.11.7 || ^0.12.0 || ^0.13.0 || ^14.0.0".
warning "aws-appsync > apollo-client@2.4.6" has incorrect peer dependency "graphql@^0.11.0 || ^0.12.0 || ^0.13.0 || ^14.0.0".
warning "aws-appsync > apollo-link@1.2.5" has incorrect peer dependency "graphql@^0.11.3 || ^0.12.3 || ^0.13.0 || ^14.0.0".
warning "aws-appsync > apollo-link-http@1.5.8" has incorrect peer dependency "graphql@^0.11.0 || ^0.12.0 || ^0.13.0 || ^14.0.0".
warning "aws-appsync > redux-thunk@2.4.2" has incorrect peer dependency "redux@^4".
warning "aws-appsync > apollo-client > apollo-link@1.2.14" has incorrect peer dependency "graphql@^0.11.3 || ^0.12.3 || ^0.13.0 || ^14.0.0 || ^15.0.0".
warning "aws-appsync > apollo-link-http > apollo-link-http-common@0.2.16" has incorrect peer dependency "graphql@^0.11.0 || ^0.12.0 || ^0.13.0 || ^14.0.0 || ^15.0.0".
slikk66 commented 1 year ago

Found an older lock file and put it into place and it worked.. then I did a full update and it broke, so something in the dependencies has changed.. not sure what :/

slikk66 commented 1 year ago

Looks like it is related to this: https://github.com/prisma/ecosystem-tests/issues/3229

Fix (for now at least) is to pin "typescript": "4.7.4"