Notice: The Monaca & Onsen UI Community Forum is shutting down.

For Onsen UI bug reports, feature requests and questions, please use the Onsen UI GitHub issues page. For help with Monaca, please contact Monaca Support Team.

Thank you to all our community for your contributions to the forum. We look forward to hearing from you in the new communication channels.

Getting error message in Monaca debug mode with onsen ui react

  • I’m having problem with using Object.assign in the main.js, under the monaca preview mode it is running without any problem, but when I use monaca debug, I saw “Uncaught TypeError: undefined is not a function” in the Applog. I have carefully checked, the error is caused by “Object.assign()”, if I remove the line the app runs on both side.

  • Hmm… As long as you are using es6 this should not occur. I guess in your case it wasn’t polyfilled and you tried to use it.

    When you use it in monaca preview you’re loading it in a browser which already has proper support for it, but the device you are using (with monaca debug) does not.

    The error doesn’t come from neither onsen nor monaca, rather if you want to use es6 you should either transpile it with babel, webpack etc, or you should polyfill the things you want to use (if you can). In this case the polyfill is actually really simple.

    Here’s a one from the mozilla docs:

    if (typeof Object.assign != 'function') {
      Object.assign = function(target) {
        'use strict';
        if (target == null) {
          throw new TypeError('Cannot convert undefined or null to object');
        target = Object(target);
        for (var index = 1; index < arguments.length; index++) {
          var source = arguments[index];
          if (source != null) {
            for (var key in source) {
              if (, key)) {
                target[key] = source[key];
        return target;

    Just load it before you want to use Object.assign and you’re good to go.