My emulator is not working

THANK YOU so much!!!!! :slight_smile:

It should be fixed now...

3 Likes

Thank you to those who worked on fixing this! The emulator is working again in my classroom with Google Chrome and Windows 10. I didn't think about trying to connect with Firefox, but I will keep that in mind if something like this happens again.

So what was the root cause?

Don't let a good outage go to waste.

1 Like

The situation is complicated.

When someone checks the "Legacy Mode" checkbox in the Companion, the Companion sets up a web server, which the user's browser then connects to. The Rendezvous server is used to "introduce" the Companion to the browser, so the browser knows where to connect to.

In many situations, the browser and the device with the Companion are on what is referred to as a "private network." Private networks are those behind network address translation (NAT) boxes, which are often found paired with cable or DSL models. A private network will typically have networks addresses like 10.X.X.X or 192.168.X.X.

When a browser loads a page from one location (aka ai2.appinventor.mit.edu) and then attempts to connect to a different address, like the address of the device, it is called a Cross Original Request (CORS). CORS connections are usually blocked by browsers unless the destination, the device in this case, provide a special set of headers called "CORS" headers. The Companion does this, so things do work.

However, some home routers are poorly coded in such a fashion that attackers can fool a user's browser to issue commands to the home router to facilitate a break in. Apparently, home device manufacturers have not all taken this problem seriously.

So, Google decided to step in and block such connections to "private addresses" EVEN WHEN CORS HEADERS ARE PROVIDED.

This broke us.

Recognizing that some legitimate uses, like ours, might need time to adapt, they created a special program where they issued us a special token which we send out to browsers when they connect to one of our App Inventor servers (aka ai2, or code, or ai2-test). This token periodically needs to be renewed. The last several times we renewed the token, the renewal just updated some database internal to Google and the actual token value did not change.

With the last renewal, this was not the case. The token (a long string of letters and numbers) was a little different. We didn't catch that. So, we continued to provide the older token, which stopped working.

The fix was to put the new token in place.

However, this is a limited time fix. At some point in the fall, Google will disable these tokens and our traditional "Legacy Mode" connection will break for good.

Fortunately, we have a new "Legacy" approach, which you can test on ai2-test.appinventor.mit.edu. You will need the Companion, available for download directly from ai2-test.appinventor.mit.edu.

The only downside to this new approach is that it puts up a dialog box that the user has to press a button on. This is because it makes use of a pop-up window and most browsers will not allow a pop-up window to open unless it is in response to user interaction (thank the sleazy advertising industry for that!), thus the need for a dialog with a button, to cause that interaction.

Please check it out. We plan to put this into production soon.

-Jeff

4 Likes


Legacy Connection timed out on my Brave session.
sample Legacy Connection run
My Brave Shields settings:

Is that a real device, or an emulator? Many emulators (the net 10 address is a give away) implement a network stack that will not accept incoming connections. Basically, as far as the host is concerned, the interface doesn't exist. WebRTC may work, but legacy mode, both old and new, likely will not.

"Old Legacy", using Genymotion Emulator works (now you just fixed it). Has been working fine before Chrome updates broke it.

I must test the "New Legacy".

It's my MemuPlay emulator.


That's what I use.

1 Like

Sorry for the slow response. Has this emulator ever worked, and if so, was it with WebRTC or legacy mode?

1 Like

I have been using the MEMUPlay emulator on Windows 7 for a while, in default (WebRTC) mode.

1 Like

Is WebRTC mode now broken? Did I break it?

Maybe Yes.

off-topic

Your Profile Pic and name changed just infront of my eyes...

Post


The ai2-test companion connects to the ai2-test server using the default connection technique (WebRTC, nothing checked) via the Connect->AI_Companion menu.

It does not look broken to me.

Thanks!

-Jeff

I am having the same problem w/ an M1 2020 Mac, OS 11.7 Big Sur. I reinstalled the emulator and aistarter is running and listening on port 8004, but it goes for infinite time saying 'this might take a minute or two.' I tried it on Chrome, Safari, and Firefox. Same result. Is there something else I can try? Is there a log file I can look at? Is there an uninstaller? Thanks.

  • dcp