awslabs / aws-mobile-appsync-sdk-js

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

aws-appsync-auth-link import size is very very large #577

Open AlexThomas90210 opened 4 years ago

AlexThomas90210 commented 4 years ago

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

What is the current behavior? aws-appsync-auth-link import size is a massive 250k, drastically increasing my bundle size

If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem. import { createAuthLink } from 'aws-appsync-auth-link'; and have a bundle analyser in vscode

What is the expected behavior? in signer.js , there is a large import of crypto = require('aws-sdk/global').util.crypto;.

The only place they are used are: return crypto.lib.createHmac('sha256', key).update(src, 'utf8').digest(encoding); return crypto.createHash('sha256').update(src, 'utf8').digest('hex');

Surely there is a more efficient way to do this instead of important such a large library?

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

DanielGibbsNZ commented 4 years ago

I would also be very interested in this as adding either aws-appsync or just aws-appsync-auth-link to my project at least doubles the bundle size.

brandonhall commented 4 years ago

I couldn't agree more. Because of this library and aws-amplify we're loading V2 and V3 of the aws-sdk. V3 checks in at 27kb gzipped while V2 checks in at 96kb gzipped. All we need from this library is createAppSyncLink for connecting to Apollo. Killing the dependency on V2 of the aws-sdk would be much appreciated.

andrejunges commented 3 years ago

@manueliglesias any updates on this matter? is there a plan to fix this in the roadmap?