-
Notifications
You must be signed in to change notification settings - Fork 183
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Uncaught TypeError: Cannot convert undefined or null to object with Android API 21 (5.0.x) #124
Comments
#121 |
#121 Uncaught TypeError: Cannot convert undefined or null to object |
Yes. Sorry I could not find a proper title before I opened this. |
@Urigo @darkbasic Any help from the grand masters of meteor. |
null:1 GET http://localhost:8100/null 404 (Not Found) Something else I realised is that even if the app works well on the browser, there is this little error it gives. Could this be another clue of is really happening? |
Hi guys, I have an update on the issue. @fernandoarevalo was right to suspect the bundler. I have realised it's not a meteor version issue for three reasons:
I suspect it is a bug in the new generated file. We might need to find the author @DAB0mB for this. |
I have the same problem |
Hi guys, there is a new release from Meteor. https://blog.meteor.com/announcing-meteor-1-5-2-105b53e0debc |
See #121 (comment) |
@lingboz Good to hear, definitely going to try it out. Also good to see @darkbasic on these streets, meteor experts are much needed since our current problem. Just wondering if you have witnessed our current problem as you rebased the tutorial -- @darkbasic. |
I'm sorry but I cannot reproduce your issue. Can you please checkout this repository and then run the following: Shell 1: Shell 2: Shell 3 (Android testing): Please be sure to update all your global packages before doing so, especially meteor-client-bundler which needs to be at least at version 0.3.0.
|
Hi @darkbasic, I have delayed to respond because I wanted to carry out some tests. So here is some feedback: Upgrading to meteor 1.5.2 and meteor-client-bundler 0.3.0 doesn't eliminate the primary error on this thread. The application still works O.K. on browser! In your solution above you mention something I want to bring to your attention - and that is sharp. The I recently installed ubuntu hoping that I would get less errors. Whereas I realise that most of the instructions in this tutorial are linux based and that it was smooth running commands on my ubuntu system, the application gives me the Disabling sharp in windows did the trick (until we find another solution). Again, I would like to stress that the application runs well on the browser on windows for me. I haven't tested it on ubuntu due to the above error. |
Hi, unfortunately Windows can be a terrible environment for doing web development. I did develop on Windows for a while and it was a nightmare. |
I realised that. Anyway which OS do you use, this could also be a factor? Have you encountered the |
I use Arch Linux. Everything could be a factor, but nonetheless it should work on any OS with the right workarounds. Never got such error, but it means there is an issue with the Meteor bundler. |
Wow. So is there a way we can use ionic and meteor without going through the meteor-client-bundler? Looks like the piece holding the two worlds together and yet we are having trouble with it. I am really interested in implementing meteor's accounts-base for my ionic app. |
If you don't want to use |
Anyway since you fixed your original issue uninstalling sharp, I'm going to close. Feel free to reopen if the issue persists. |
Actually the original issue was about the app failing to work on mobile due to the current meteor-client issue. Sharp and others were just additionals. From my response above I indicated that the problem is not yet solved. I am also keen to see what others who had the same problem have to say. |
Can you please post the output of all the commands mentioned before, including |
$ meteor npm install sharp
$ npm run api
$ npm run meteor-client:bundle
npm run ionic:serve
$ cordova platform add android
$ cordova run android
I get a blank screen. On inspection I get this: I didn't clone from github but rather followed step by step up to step 16. I can also email you the two meteor-client.js files from before and after this period of time we think something changed. someone has talked about these two lines;
but removing them has not solved the issue for me. And inspecting the old working meteor-client.js these lines are present so I suspect it could be something else. Again, because I am not that technical on the subject I can't tell which changes affected the android tests, Looking at both files (and I have compared at least 1000 lines of code) its easy to see the differences even if I don't understand much of whats going on. $ npm -g list --depth=0
Hope this can throw more light. |
No please repeat the steps cloning the repo with Shell 1:
Shell 2:
Shell 3 (Android testing):
Which version of node and npm are you on? If sharp still creates problems you can simply skip |
O.K. so following your instructions to the dot: I cloned the repo $ npm install
$ npm uninstall sharp
I disabled sharp at this moment $ npm run api
I removed all the re-run
So I deleted the api folder and installed a new server using
So again... $ npm run api
Then $ npm run meteor-client:bundle
$ npm run ionic:serve
I add
to the path and
as opposed to
in the tsconfig.json root file which takes care of the transpile errors $ npm run ionic:serve
The app launches but I can't login. At inspection on the console I have this error: So at this point I have three errors: cordova platform add android
cordova run android
|
Thanks, it seems the tutorial deserves some testing on Windows because I don't get any of your errors. |
Well I know @lingboz on this thread uses Windows and had the same issue. Am not sure about the others but I inquired the same on #121. You are right about the connection issue. This is such a good tutorial damn the bug. Alternative could you share with me a meteor-client.js file that you generated before july. I can patch it in my project for now as a solution comes along. Using my old file seems to work, the only problem is that it was updated upto stage 11 and before things went bad. |
This is from the Meteor 1.6 tutorial. Please tell me if it works for you (obviously you will have to use the new Meteor 1.6 tutorial). |
Hi @darkbasic I really appreciate the endeavored help from you. I had the same issue with @pkitatta on windows dev environment. I removed these two lines: and it fixed my issue temporarily. But I would say that this is a hacky solution (we changed Meteor library code), and the problem might be possible to come back in later releases. So we were discussing a lot to investigate in these following threads: #121 I would like to clone your repo and test it on my linux VM as soon as possible. I am sorry that I did not test things as you discussed because I was too busy during these few days. |
Thanks for the heads up @lingboz . I just don't know why when I remove those two lines it doesn't work for me! And the problem is that every time I tamper with the meteor-client file I get errors on my next meteor bundle. I wonder if you have successfully |
Hi @pkitatta I am testing the project @darkbasic provided. I removed all stuff related to "sharp" and removed some code in the server/collections folder to avoid compile time errors. I then ran the project on Ubuntu 16.04 and ran it on a device using "cordova run android --device". The project worked with no errors. @darkbasic uses Meteor 1.6 but I wonder if Meteor 1.5.2 would also work on Linux. If Meteor 1.5.2 works well on Linux I would suspect this is related to Windows platform. But if Meteor 1.5.2 does not work on Linux then I want to test if Meteor 1.6 also works on Windows. Since Meteor 1.6 is not published yet and more changes may be added to Meteor 1.6 so I am not sure if I should update my work to 1.6. I will do more test and update my results tomorrow. @pkitatta Can you do a Meteor 1.5.2 test on Windows from scratch (following the tutorial and remove anything that may cause a compile error) |
I will do a clean project from scratch for Meteor 1.5.2 on Ubuntu and see what happens |
I will also do that. |
Hi guys, I conducted my tests on Ubuntu 16.04. My dev environment is: The package I used is Meteor 1.6-beta 26, and is cloned from https://github.com/darkbasic/Ionic2CLI-Meteor-WhatsApp.git from @darkbasic I removed and commented code and steps about "sharp" package. I did the tests on 3 different android devices and 2 ios devices Android 5.1 Moto G ios 10.3.3 ipad The Android results are as follows: Android 5.1 failed to run with the error below: However after I removed these two line from meteor-client.js:
The app loaded successfully with the output below: The interesting thing is, the other two Android devices have no errors So I suspect this is related to different Android images. And my linux machine does not support emulator, so I would appreciate anyone who can run more tests on Android Emulators under Ubuntu. For example, download an image with Android 5.1 and see what happens. The test result on ios are: Initially there was an error like this: And I downloaded a sample GoogleService-Info.plist on the Internet and the build succeeded. When I ran the app, there was an error and the app did not load: I know there is a GoogleService-Info.plist in resources folder but for some reason it is not working. I think this error is really related to Google login service and we should disable this feature for testing However, since my main development target is ios, I know that the same thing is happening for ios. The screenshot from my own app is as below (it is actually the same problem with Android 5.1): I will conduct another test tomorrow. I will update my results. @darkbasic I really appreciate your help and the help from the angular-meteor communities, currently I guess this issue may be or may not be closely relate to "angular-meteor" or "meteor-client-bundler" and it might be an error hidden inside Cordova and Meteor's libraries, or Webpack typescript stuffs. We are not sure. But since we encounter the error when using this github code, I should probably do some more investigation here and share my results. |
Thanks @lingboz for the update. |
Hi Android 5.1.1 and Android 7.1.1 works when the two lines present |
I managed to assembly a faster pc with some spare parts, finally I have enough ram to run an emulator while developing. I comfirm the issue with Android 5.0.x. |
Hi guys, I found that the two lines of code come from the Meteor package called "ecmascript-runtime-client", I tried to only "import" the basic package "meteor-base" in my meteor-client.config.json but it did not work. BTW, I double checked the source code of "meteor-client-bundler", and I guess the "import" function in "meteor-client-bundle" package is not working properly. So, there is no way to disable the default packages from "api/.meteor" folder unless we change that "packages" file manually (which means we will always use some unnecessary packages regardless how we set the user "imports"). |
Hi @lingboz, this is true. I found the culprit package sometime back. The interesting thing is that deleting the lines in the local server I.e. |
But isn't it odd that these two lines are present in the old working meteor-client file?! Seriously, testing with Android 4.2.2 was possible with the old file while these two lines were present. |
Hi, I did a minimum viable version for Ionic2CLI-Meteor-WhatsApp. https://github.com/lingboz/Ionic2CLI-Meteor-WhatsApp-Minimum-Viable You can downlowd it and run: $ git clone https://github.com/lingboz/Ionic2CLI-Meteor-WhatsApp-Minimum-Viable.git Running this project on Android 5.1 or ios 10.3.3 will produce the error below: |
Maybe it depends on the WebView version? We should try to install a very old WebView package from the 5.1 era on a newer Android device to see what happens. |
Sorry, but I don't think this is of WebView version. Bcz I've try to install it on iOS iPhone 6 Emulator and it's still not work. @lingboz It is bcz of incorrect path. If you go to platforms/ios/resource folder from xcode and select GoogleService-Info.plist you will see one line. I just remove GoogleService-Info.plist and add it again to this resource folder. |
Hi guys, how about if we use crosswalk, do you think it can work? I can't imagine that the app wouldn't work in android<7. I was planning on plugging it into my app and taking it to production. I expect a good number of users to be using android below 7. |
@pkitatta |
Hmmm..... about webview in iOS:
|
I don't know maybe it will help. I found old folder with project from august, so for compartion - created a patch with diff of meteor-client.js bundles from august to october. Also tomorrow will check on iOS with comment of this lines:
|
So, it works now! Just when I comment this lines inside generated meteor-client.js:
Tested on iOS emulator 10.3 and real device (iPhone 7). So, description about typed arrays
Source code of uint8-array and uint32-array |
Hey everyone, I tried to dig a little deeper, starting from the solution of commenting the two lines in meteor-client regarding typed arrays. As far as I understand the error, it comes from the core-js module, more specifically, it came up on version 2.5, which was released on 6 August. This is very close to the time, when I first encountered the problem. Based on that, I was able to narrow it down a bit more. To my understanding, the problem mainly comes from the _typed-array.js, this has undergone changed from version 2.4.1 to version 2.5.0. I was able to obtain a running version of my app, when I replaced the _typed-array.js within the meteor-client.js (took me some time until I got it running) with the version 2.4.1 (without commenting the two lines above). So, the only thing we would need to do is to downgrade core-js to version 2.4.1 until a solution is found. So I thought... I tried to force meteor (and meteor-client-bundler) to install core-js 2.4.1 by adding it to the dependencies but it never worked. I figured, their might be another package requiring the core-js and inverstigated the depency path. Long story short, babel requires core-js two, but does not require 2.5.0 or above (at lest in version 6.24.1). I explicitly set babel and it subpackages to versions running with core-js. Still, the client bundler would include the core-js 2.5.1. Okay, what next. I found one last trace of core-js in the whole (hay)stack. Meteor itself includes core-js starting with meteor 1.5. But it does so not through package management it seems (see package.js), but through Npm.depends. Anyhow, core-js version 2.4.1 is included. So this should not be the problem... I am not completely sure what happens here, but I have nothing left to blame :-/ Okay, to sum this up: Problem origin: comes from core-js version change 2.4.1 -> 2.5.0 from _typed-array.js. Babel and meteor are using this. Meteor includes it directly vie Npm.depends, making it hard to tinker with it. My current solution: instead of commenting the two line in meteor-client, I did the following: Step 1: exchange the _typed-array.js in the npm cache, by opening the package.tgz in ~/.npm/core-js/2.5.[0|1] , open the file package/modules/_typed-array.js and replace the code with the version 2.4.1 code and update the package. As this solution will introduce a potentially errornous core-js, we will make sure, that outside of the meteor-client an intact version is used. Step 2 force babel to use core-js 2.4.1 by explicitely downgrading babel-dependencies and core-js. Insert the following into package.json: caution: This solution is far from perfect and I would not recommend to do this if you use meteor or core-js in any other project. Editing core-js in npm cache changes it for all your projects! Also, at some point another version of babel will be needed for sure and then the core-js ^2.5.0 will be back. For me this works for now. The advantage, I obtain a runnable meteor-client.js after bundling and don't have to tinker with it anymore. |
Thanks @wilkovanhoek, I will try to investigate. In the meantime thanks for your workaround. |
See also meteor/meteor#9024 |
I am facing the same issue . Below is the my service for get http request getSD(): Observable { here is my component function getALLSD() when checking in console its showing error ERROR TypeError: Cannot convert undefined or null to object when using ngFor its showing the value {{ person.name}} |
had this same error. tried downgrading meteor to 1.5.x and [email protected] but still the error was there. Then finally found out that this error is only showing on emulator. If you face this problem then try running in actual device first. |
The app used to load on android until I got this error which started about 2 weeks ago. I have done everything (including reinstalling my entire environment) but nothing seems to work.
Before testing on android the app works well on firefox, chrome but not explorer. After testing on android, firefox is affected and then chrome is on and off; sometimes giving the error and sometimes not depending on whether you have first run it on android.
I suspect it could be a meteor issue because android tests start failing around step 4 when I install meteor in the project.
Anyone have an idea?
The text was updated successfully, but these errors were encountered: