Closed ffxsam closed 1 year ago
@ffxsam Whats the issue on amplify you are seeing as result of the paho-mqtt
broken??
@ashika01 It's all detailed in the link above.
I am working on trying to reproduce the issue locally in a sample but I am having issues with just trying to connect. I keep getting websocket connection failed
errors unlike the local storage issues in the link
paho-mqtt is using an EPL license (Eclipse Public License) if I see it correctly. Can I use it in my JavaScript Browser application? Isn't it a problem when WebPack is modifying the code and distributing it to a huge number of devices via the internet? Is it compatible with the Apache license? -> Found an answer to this question that has already been discussed: https://github.com/aws/aws-iot-device-sdk-embedded-C/issues/142
Hi @ffxsam , I'm using Amplify.js and facing the same issue... Had you solved this problem eventually?
@yaquawa I sure did. The solution was to use Yarn's patch
feature (make sure you're using Yarn 3.x). But I can save you most of the work.
In case you're using the old Yarn 1.x, the quickest way to switch to the latest version:
$ cd myproject
$ yarn set version berry
$ yarn config set nodeLinker node-modules
and add this to your .gitignore:
# Yarn 2
.yarn/*
!.yarn/patches
!.yarn/releases
!.yarn/plugins
!.yarn/sdks
!.yarn/versions
.pnp.*
Once that's all set up, copy this file into .yarn/patches
:
Make sure paho-mqtt
is installed. Then add this to your project's package.json
:
"resolutions": {
"paho-mqtt": "patch:paho-mqtt@npm:1.1.0#.yarn/patches/paho-mqtt-npm-1.1.0-c2bf8169e8"
}
Finally, run yarn
to apply the patch and it's done! Anytime anyone clones your project and runs yarn
, it'll take care of patching this for you.
@stocaaro would you be able to help here?
+1. I updated to the latest aws-amplify and just ran into these bugs. So it seems somehow we're even more exposed to paho-mqtt's issues than before.
Hey @abdallahshaban557! I could be way off base, but this seems like a somewhat critical issue? (is "somewhat" critical a thing? 😆)
Hi @ffxsam - We've had a couple of investigations on this that have not been fully completed, our issue has been identifying a dependency that we can use that can provide us with coverage to both Web and React Native. There is still some ground work for us to do - and we'll respond back with updates when we have them.
@abdallahshaban557 Thanks, much appreciated! At least it's easy enough to use yarn's or pnpm's patch feature to work around this.
@ffxsam We now have a PR up to address the issue and are working to get this out in the next release which will go out later this week.
Longer term we will look into moving to something other than paho-mqtt
for customers using Amplify with IoT. We already do not depend on it for connecting to AppSync.
Thanks for raising this issue and your patience while we get this resolved.
@Ashish-Nanda Great news, thanks for the update! 💪
Hello @ffxsam,
The change that includes the paho-mqtt
patch in Amplify was released today. If you upgrade to aws-amplify@5.0.10
or later, your application should support PubSub for users who have cookies disabled.
Awesome, thank you!
Before opening, please confirm:
JavaScript Framework
Not applicable
Amplify APIs
PubSub
Amplify Categories
Not applicable
Environment information
Describe the bug
AWS Amplify should definitely consider replacing
paho-mqtt
with something else. It's a package that's no longer maintained, and has issues which are causing Amplify to break.While there are workarounds like using
patch-package
to monkey patch it, this isn't ideal as many people don't know this is even possible (I didn't know until today!).Expected behavior
N/A
Reproduction steps
N/A
Code Snippet
No response
Log output
No response
aws-exports.js
No response
Manual configuration
No response
Additional configuration
No response
Mobile Device
No response
Mobile Operating System
No response
Mobile Browser
No response
Mobile Browser Version
No response
Additional information and screenshots
No response