awslabs / aws-mobile-appsync-sdk-js

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

create-react-app v 5, webpack 5, causes multiple warnings #703

Open jacobgranberry opened 2 years ago

jacobgranberry commented 2 years ago

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

What is the current behavior?

If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem. Install CRA5 with aws-appsync

What is the expected behavior? CRA5 should compile with no warnings

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

Has anyone run into this issue or reconciled it somehow? Getting lots of warnings after upgrading react-scripts to version 5.0.0 which includes webpack 5. Everything compiles fine.

Versions: "aws-appsync": "^4.1.4", "graphql": "^15.7.0",

Sample of the warnings thrown, all rooted in the aws-appsync dependency:

WARNING in ../../node_modules/apollo-cache-inmemory/lib/depTrackingCache.js
Module Warning (from ../../node_modules/react-scripts/node_modules/source-map-loader/dist/cjs.js):
Failed to parse source map from '/home/geeberry/Working/company-com-dashboard-nextgen/node_modules/apollo-cache-inmemory/src/depTrackingCache.ts' file: Error: ENOENT: no such file or directory, open '/home/geeberry/Working/company-com-dashboard-nextgen/node_modules/apollo-cache-inmemory/src/depTrackingCache.ts'
 @ ../../node_modules/apollo-cache-inmemory/lib/readFromStore.js 19:0-54 45:42-58 60:54-70
 @ ../../node_modules/apollo-cache-inmemory/lib/index.js 2:0-32 2:0-32
 @ ../../node_modules/aws-appsync/lib/client.js 213:30-62
 @ ../../node_modules/aws-appsync/lib/index.js 17:15-34 19:9-28
 @ ./src/services/secure-app-sync-client.js 8:0-40 55:2-15
 @ ./src/services/user/user-svc.ts 6:0-60 36:19-34 100:19-34 138:19-34 176:19-34 210:19-34 257:19-34 294:19-34 328:19-34 366:19-34 399:19-34 428:19-34 458:19-34 508:19-34 561:19-34 598:19-34 716:19-34 754:19-34 792:19-34 843:19-34 879:19-34 907:19-34 935:19-34 966:19-34 1023:19-34 1079:19-34 1108:19-34 1137:19-34 1225:19-34 1254:19-34 1290:19-34 1361:19-34 1441:19-34
 @ ./src/app.tsx 192:0-51 228:19-26
 @ ./src/index.tsx 19:0-24 156:43-46

WARNING in ../../node_modules/apollo-cache-inmemory/lib/fixPolyfills.js
Module Warning (from ../../node_modules/react-scripts/node_modules/source-map-loader/dist/cjs.js):
Failed to parse source map from '/home/geeberry/Working/company-com-dashboard-nextgen/node_modules/apollo-cache-inmemory/src/fixPolyfills.ts' file: Error: ENOENT: no such file or directory, open '/home/geeberry/Working/company-com-dashboard-nextgen/node_modules/apollo-cache-inmemory/src/fixPolyfills.ts'
 @ ../../node_modules/apollo-cache-inmemory/lib/inMemoryCache.js 43:0-24
 @ ../../node_modules/apollo-cache-inmemory/lib/index.js 1:0-73 1:0-73 1:0-73
 @ ../../node_modules/aws-appsync/lib/client.js 213:30-62
 @ ../../node_modules/aws-appsync/lib/index.js 17:15-34 19:9-28
 @ ./src/services/secure-app-sync-client.js 8:0-40 55:2-15
 @ ./src/services/user/user-svc.ts 6:0-60 36:19-34 100:19-34 138:19-34 176:19-34 210:19-34 257:19-34 294:19-34 328:19-34 366:19-34 399:19-34 428:19-34 458:19-34 508:19-34 561:19-34 598:19-34 716:19-34 754:19-34 792:19-34 843:19-34 879:19-34 907:19-34 935:19-34 966:19-34 1023:19-34 1079:19-34 1108:19-34 1137:19-34 1225:19-34 1254:19-34 1290:19-34 1361:19-34 1441:19-34
 @ ./src/app.tsx 192:0-51 228:19-26
 @ ./src/index.tsx 19:0-24 156:43-46

WARNING in ../../node_modules/apollo-cache-inmemory/lib/fragmentMatcher.js
Module Warning (from ../../node_modules/react-scripts/node_modules/source-map-loader/dist/cjs.js):
Failed to parse source map from '/home/geeberry/Working/company-com-dashboard-nextgen/node_modules/apollo-cache-inmemory/src/fragmentMatcher.ts' file: Error: ENOENT: no such file or directory, open '/home/geeberry/Working/company-com-dashboard-nextgen/node_modules/apollo-cache-inmemory/src/fragmentMatcher.ts'
 @ ../../node_modules/apollo-cache-inmemory/lib/index.js 4:0-34 4:0-34
 @ ../../node_modules/aws-appsync/lib/client.js 213:30-62
 @ ../../node_modules/aws-appsync/lib/index.js 17:15-34 19:9-28
 @ ./src/services/secure-app-sync-client.js 8:0-40 55:2-15
 @ ./src/services/user/user-svc.ts 6:0-60 36:19-34 100:19-34 138:19-34 176:19-34 210:19-34 257:19-34 294:19-34 328:19-34 366:19-34 399:19-34 428:19-34 458:19-34 508:19-34 561:19-34 598:19-34 716:19-34 754:19-34 792:19-34 843:19-34 879:19-34 907:19-34 935:19-34 966:19-34 1023:19-34 1079:19-34 1108:19-34 1137:19-34 1225:19-34 1254:19-34 1290:19-34 1361:19-34 1441:19-34
 @ ./src/app.tsx 192:0-51 228:19-26
 @ ./src/index.tsx 19:0-24 156:43-46

WARNING in ../../node_modules/apollo-cache-inmemory/lib/inMemoryCache.js
Module Warning (from ../../node_modules/react-scripts/node_modules/source-map-loader/dist/cjs.js):
Failed to parse source map from '/home/geeberry/Working/company-com-dashboard-nextgen/node_modules/apollo-cache-inmemory/src/inMemoryCache.ts' file: Error: ENOENT: no such file or directory, open '/home/geeberry/Working/company-com-dashboard-nextgen/node_modules/apollo-cache-inmemory/src/inMemoryCache.ts'
 @ ../../node_modules/apollo-cache-inmemory/lib/index.js 1:0-73 1:0-73 1:0-73
 @ ../../node_modules/aws-appsync/lib/client.js 213:30-62
 @ ../../node_modules/aws-appsync/lib/index.js 17:15-34 19:9-28
 @ ./src/services/secure-app-sync-client.js 8:0-40 55:2-15
 @ ./src/services/user/user-svc.ts 6:0-60 36:19-34 100:19-34 138:19-34 176:19-34 210:19-34 257:19-34 294:19-34 328:19-34 366:19-34 399:19-34 428:19-34 458:19-34 508:19-34 561:19-34 598:19-34 716:19-34 754:19-34 792:19-34 843:19-34 879:19-34 907:19-34 935:19-34 966:19-34 1023:19-34 1079:19-34 1108:19-34 1137:19-34 1225:19-34 1254:19-34 1290:19-34 1361:19-34 1441:19-34
 @ ./src/app.tsx 192:0-51 228:19-26
 @ ./src/index.tsx 19:0-24 156:43-46

WARNING in ../../node_modules/apollo-cache-inmemory/lib/index.js
Module Warning (from ../../node_modules/react-scripts/node_modules/source-map-loader/dist/cjs.js):
Failed to parse source map from '/home/geeberry/Working/company-com-dashboard-nextgen/node_modules/apollo-cache-inmemory/src/index.ts' file: Error: ENOENT: no such file or directory, open '/home/geeberry/Working/company-com-dashboard-nextgen/node_modules/apollo-cache-inmemory/src/index.ts'
 @ ../../node_modules/aws-appsync/lib/client.js 213:30-62
 @ ../../node_modules/aws-appsync/lib/index.js 17:15-34 19:9-28
 @ ./src/services/secure-app-sync-client.js 8:0-40 55:2-15
 @ ./src/services/user/user-svc.ts 6:0-60 36:19-34 100:19-34 138:19-34 176:19-34 210:19-34 257:19-34 294:19-34 328:19-34 366:19-34 399:19-34 428:19-34 458:19-34 508:19-34 561:19-34 598:19-34 716:19-34 754:19-34 792:19-34 843:19-34 879:19-34 907:19-34 935:19-34 966:19-34 1023:19-34 1079:19-34 1108:19-34 1137:19-34 1225:19-34 1254:19-34 1290:19-34 1361:19-34 1441:19-34
 @ ./src/app.tsx 192:0-51 228:19-26
 @ ./src/index.tsx 19:0-24 156:43-46

WARNING in ../../node_modules/apollo-cache-inmemory/lib/objectCache.js
Module Warning (from ../../node_modules/react-scripts/node_modules/source-map-loader/dist/cjs.js):
Failed to parse source map from '/home/geeberry/Working/company-com-dashboard-nextgen/node_modules/apollo-cache-inmemory/src/objectCache.ts' file: Error: ENOENT: no such file or directory, open '/home/geeberry/Working/company-com-dashboard-nextgen/node_modules/apollo-cache-inmemory/src/objectCache.ts'
 @ ../../node_modules/apollo-cache-inmemory/lib/index.js 5:0-30 5:0-30
 @ ../../node_modules/aws-appsync/lib/client.js 213:30-62
 @ ../../node_modules/aws-appsync/lib/index.js 17:15-34 19:9-28
 @ ./src/services/secure-app-sync-client.js 8:0-40 55:2-15
 @ ./src/services/user/user-svc.ts 6:0-60 36:19-34 100:19-34 138:19-34 176:19-34 210:19-34 257:19-34 294:19-34 328:19-34 366:19-34 399:19-34 428:19-34 458:19-34 508:19-34 561:19-34 598:19-34 716:19-34 754:19-34 792:19-34 843:19-34 879:19-34 907:19-34 935:19-34 966:19-34 1023:19-34 1079:19-34 1108:19-34 1137:19-34 1225:19-34 1254:19-34 1290:19-34 1361:19-34 1441:19-34
 @ ./src/app.tsx 192:0-51 228:19-26
 @ ./src/index.tsx 19:0-24 156:43-46

WARNING in ../../node_modules/apollo-cache-inmemory/lib/optimism.js
Module Warning (from ../../node_modules/react-scripts/node_modules/source-map-loader/dist/cjs.js):
Failed to parse source map from '/home/geeberry/Working/company-com-dashboard-nextgen/node_modules/apollo-cache-inmemory/src/optimism.ts' file: Error: ENOENT: no such file or directory, open '/home/geeberry/Working/company-com-dashboard-nextgen/node_modules/apollo-cache-inmemory/src/optimism.ts'    
 @ ../../node_modules/apollo-cache-inmemory/lib/readFromStore.js 18:0-48 25:25-37 35:29-33 52:31-35
 @ ../../node_modules/apollo-cache-inmemory/lib/index.js 2:0-32 2:0-32
 @ ../../node_modules/aws-appsync/lib/client.js 213:30-62
 @ ../../node_modules/aws-appsync/lib/index.js 17:15-34 19:9-28
 @ ./src/services/secure-app-sync-client.js 8:0-40 55:2-15
 @ ./src/services/user/user-svc.ts 6:0-60 36:19-34 100:19-34 138:19-34 176:19-34 210:19-34 257:19-34 294:19-34 328:19-34 366:19-34 399:19-34 428:19-34 458:19-34 508:19-34 561:19-34 598:19-34 716:19-34 754:19-34 792:19-34 843:19-34 879:19-34 907:19-34 935:19-34 966:19-34 1023:19-34 1079:19-34 1108:19-34 1137:19-34 1225:19-34 1254:19-34 1290:19-34 1361:19-34 1441:19-34
 @ ./src/app.tsx 192:0-51 228:19-26
 @ ./src/index.tsx 19:0-24 156:43-46
awe79 commented 2 years ago

Any progress / workarounds regarding this issue? We have the same issue when we to update react-scripts to 5.0.0 for node 17 compatibility.

jacobgranberry commented 2 years ago

I have not unfortunately, seems like something that may have to be resolved on CRA's end, but the fact that they released 5.0 3 months ago and haven't had a single bug patch for it doesn't give me a lot of confidence in getting a fix anytime soon.

jacobgranberry commented 2 years ago

@awe79 any luck on your end resolving this?

awe79 commented 2 years ago

@jacobgranberry nope we postponed the upgrade. Will take al look again in a couple of months.

pauchena commented 1 year ago

Hi! Any update on that? I'm currently having the sames warnings with "aws-appsync": "^4.1.9"

awe79 commented 1 year ago

@pauchena my advise would be to move away from the aws-appsync lib as much as possible since it also has poor/no support for hooks like useQuery and there does not seem to be much development.

Use only the 'aws-appsync-auth-link' to create the authlink and use that to make an ApolloLink for the ApolloClient