question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

transformObjectKeys: true causes TypeError: Cannot read property 'call' of undefined

See original GitHub issue

Raw Script: console.log('test');

Script after build with webpack:

/******/ (function(modules) { // webpackBootstrap
/******/ 	// The module cache
/******/ 	var installedModules = {};
/******/
/******/ 	// The require function
/******/ 	function __webpack_require__(moduleId) {
/******/
/******/ 		// Check if module is in cache
/******/ 		if(installedModules[moduleId]) {
/******/ 			return installedModules[moduleId].exports;
/******/ 		}
/******/ 		// Create a new module (and put it into the cache)
/******/ 		var module = installedModules[moduleId] = {
/******/ 			i: moduleId,
/******/ 			l: false,
/******/ 			exports: {}
/******/ 		};
/******/
/******/ 		// Execute the module function
/******/ 		modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/
/******/ 		// Flag the module as loaded
/******/ 		module.l = true;
/******/
/******/ 		// Return the exports of the module
/******/ 		return module.exports;
/******/ 	}
/******/
/******/
/******/ 	// expose the modules object (__webpack_modules__)
/******/ 	__webpack_require__.m = modules;
/******/
/******/ 	// expose the module cache
/******/ 	__webpack_require__.c = installedModules;
/******/
/******/ 	// define getter function for harmony exports
/******/ 	__webpack_require__.d = function(exports, name, getter) {
/******/ 		if(!__webpack_require__.o(exports, name)) {
/******/ 			Object.defineProperty(exports, name, { enumerable: true, get: getter });
/******/ 		}
/******/ 	};
/******/
/******/ 	// define __esModule on exports
/******/ 	__webpack_require__.r = function(exports) {
/******/ 		if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
/******/ 			Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
/******/ 		}
/******/ 		Object.defineProperty(exports, '__esModule', { value: true });
/******/ 	};
/******/
/******/ 	// create a fake namespace object
/******/ 	// mode & 1: value is a module id, require it
/******/ 	// mode & 2: merge all properties of value into the ns
/******/ 	// mode & 4: return value when already ns object
/******/ 	// mode & 8|1: behave like require
/******/ 	__webpack_require__.t = function(value, mode) {
/******/ 		if(mode & 1) value = __webpack_require__(value);
/******/ 		if(mode & 8) return value;
/******/ 		if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
/******/ 		var ns = Object.create(null);
/******/ 		__webpack_require__.r(ns);
/******/ 		Object.defineProperty(ns, 'default', { enumerable: true, value: value });
/******/ 		if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
/******/ 		return ns;
/******/ 	};
/******/
/******/ 	// getDefaultExport function for compatibility with non-harmony modules
/******/ 	__webpack_require__.n = function(module) {
/******/ 		var getter = module && module.__esModule ?
/******/ 			function getDefault() { return module['default']; } :
/******/ 			function getModuleExports() { return module; };
/******/ 		__webpack_require__.d(getter, 'a', getter);
/******/ 		return getter;
/******/ 	};
/******/
/******/ 	// Object.prototype.hasOwnProperty.call
/******/ 	__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
/******/
/******/ 	// __webpack_public_path__
/******/ 	__webpack_require__.p = "/";
/******/
/******/
/******/ 	// Load entry module and return exports
/******/ 	return __webpack_require__(__webpack_require__.s = 0);
/******/ })
/************************************************************************/
/******/ ({

/***/ "./resources/js/loader.js":
/*!********************************!*\
  !*** ./resources/js/loader.js ***!
  \********************************/
/*! no static exports found */
/***/ (function(module, exports) {

console.log('test');

/***/ }),

/***/ 0:
/*!**************************************!*\
  !*** multi ./resources/js/loader.js ***!
  \**************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {

module.exports = __webpack_require__(/*! /Users/zobov/Desktop/projects/test/resources/js/loader.js */"./resources/js/loader.js");


/***/ })

/******/ });

Obfuscator Config:

{
     transformObjectKeys: true
}

After build with obfuscator: var _0x37ba=['value','Module','defineProperty','object','__esModule','default','hasOwnProperty','call','test','exports','enumerable','get','undefined','toStringTag'];(function(_0x5a6433,_0x3dd879){var _0x2da372=function(_0x283e2e){while(--_0x283e2e){_0x5a6433['push'](_0x5a6433['shift']());}};_0x2da372(++_0x3dd879);}(_0x37ba,0xcc));var _0x3396=function(_0x5a6433,_0x3dd879){_0x5a6433=_0x5a6433-0x0;var _0x2da372=_0x37ba[_0x5a6433];return _0x2da372;};var _0x5dedd7={};_0x5dedd7['./resources/js/loader.js']=function(_0x393828,_0x52fc40){console['log'](_0x3396('0x0'));};(function(_0x57f0fc){var _0x227dcd={};function _0xddb5a0(_0x3e3dee){if(_0x227dcd[_0x3e3dee]){return _0x227dcd[_0x3e3dee][_0x3396('0x1')];}var _0x3dcbf2=_0x227dcd[_0x3e3dee]={};_0x227dcd[_0x3e3dee]['i']=_0x3e3dee;_0x227dcd[_0x3e3dee]['l']=![];_0x227dcd[_0x3e3dee][_0x3396('0x1')]={};_0x57f0fc[_0x3e3dee]['call'](_0x3dcbf2[_0x3396('0x1')],_0x3dcbf2,_0x3dcbf2[_0x3396('0x1')],_0xddb5a0);_0x3dcbf2['l']=!![];return _0x3dcbf2[_0x3396('0x1')];}_0xddb5a0['m']=_0x57f0fc;_0xddb5a0['c']=_0x227dcd;_0xddb5a0['d']=function(_0x16380c,_0x248174,_0x356b08){if(!_0xddb5a0['o'](_0x16380c,_0x248174)){var _0x38e7ab={};_0x38e7ab[_0x3396('0x2')]=!![];_0x38e7ab[_0x3396('0x3')]=_0x356b08;Object['defineProperty'](_0x16380c,_0x248174,_0x38e7ab);}};_0xddb5a0['r']=function(_0x59b0c4){if(typeof Symbol!==_0x3396('0x4')&&Symbol[_0x3396('0x5')]){var _0x29215d={};_0x29215d[_0x3396('0x6')]=_0x3396('0x7');Object['defineProperty'](_0x59b0c4,Symbol[_0x3396('0x5')],_0x29215d);}var _0x4df37a={};_0x4df37a[_0x3396('0x6')]=!![];Object[_0x3396('0x8')](_0x59b0c4,'__esModule',_0x4df37a);};_0xddb5a0['t']=function(_0x56e782,_0xbe6a9c){if(_0xbe6a9c&0x1)_0x56e782=_0xddb5a0(_0x56e782);if(_0xbe6a9c&0x8)return _0x56e782;if(_0xbe6a9c&0x4&&typeof _0x56e782===_0x3396('0x9')&&_0x56e782&&_0x56e782[_0x3396('0xa')])return _0x56e782;var _0x249096=Object['create'](null);_0xddb5a0['r'](_0x249096);var _0x48fc31={};_0x48fc31[_0x3396('0x2')]=!![];_0x48fc31[_0x3396('0x6')]=_0x56e782;Object[_0x3396('0x8')](_0x249096,'default',_0x48fc31);if(_0xbe6a9c&0x2&&typeof _0x56e782!='string')for(var _0x528be5 in _0x56e782)_0xddb5a0['d'](_0x249096,_0x528be5,function(_0x528be5){return _0x56e782[_0x528be5];}['bind'](null,_0x528be5));return _0x249096;};_0xddb5a0['n']=function(_0x12db92){var _0x47d618=_0x12db92&&_0x12db92[_0x3396('0xa')]?function getDefault(){return _0x12db92[_0x3396('0xb')];}:function getModuleExports(){return _0x12db92;};_0xddb5a0['d'](_0x47d618,'a',_0x47d618);return _0x47d618;};_0xddb5a0['o']=function(_0xd22169,_0x583027){return Object['prototype'][_0x3396('0xc')][_0x3396('0xd')](_0xd22169,_0x583027);};_0xddb5a0['p']='/';return _0xddb5a0(_0xddb5a0['s']=0x0);}(_0x5dedd7));

In versions up to 0.20.4 error not appears.

Your Environment

  • Obfuscator version used: > 0.20.4
  • Node version used: 10.18.0

Stack trace

/Users/zobov/Desktop/projects/test/public/js/loader.js:1
var _0x37ba=['value','Module','defineProperty','object','__esModule','default','hasOwnProperty','call','test','exports','enumerable','get','undefined','toStringTag'];(function(_0x5a6433,_0x3dd879){var _0x2da372=function(_0x283e2e){while(--_0x283e2e){_0x5a6433['push'](_0x5a6433['shift']());}};_0x2da372(++_0x3dd879);}(_0x37ba,0xcc));var _0x3396=function(_0x5a6433,_0x3dd879){_0x5a6433=_0x5a6433-0x0;var _0x2da372=_0x37ba[_0x5a6433];return _0x2da372;};var _0x5dedd7={};_0x5dedd7['./resources/js/loader.js']=function(_0x393828,_0x52fc40){console['log'](_0x3396('0x0'));};(function(_0x57f0fc){var _0x227dcd={};function _0xddb5a0(_0x3e3dee){if(_0x227dcd[_0x3e3dee]){return _0x227dcd[_0x3e3dee][_0x3396('0x1')];}var _0x3dcbf2=_0x227dcd[_0x3e3dee]={};_0x227dcd[_0x3e3dee]['i']=_0x3e3dee;_0x227dcd[_0x3e3dee]['l']=![];_0x227dcd[_0x3e3dee][_0x3396('0x1')]={};_0x57f0fc[_0x3e3dee]['call'](_0x3dcbf2[_0x3396('0x1')],_0x3dcbf2,_0x3dcbf2[_0x3396('0x1')],_0xddb5a0);_0x3dcbf

TypeError: Cannot read property 'call' of undefined
    at _0xddb5a0 (/Users/zobov/Desktop/projects/test/public/js/loader.js:1:872)
    at /Users/zobov/Desktop/projects/test/public/js/loader.js:1:2668
    at Object.<anonymous> (/Users/zobov/Desktop/projects/test/public/js/loader.js:1:2699)
    at Module._compile (internal/modules/cjs/loader.js:778:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
    at Module.load (internal/modules/cjs/loader.js:653:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
    at Function.Module._load (internal/modules/cjs/loader.js:585:3)
    at Function.Module.runMain (internal/modules/cjs/loader.js:831:12)
    at startup (internal/bootstrap/node.js:283:19)

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:14 (10 by maintainers)

github_iconTop GitHub Comments

1reaction
sanex3339commented, Jan 15, 2020

Thank you for the issue, will fix it in a few days, maybe today.

0reactions
sanex3339commented, Mar 20, 2020

@ahmetburakatli also, here is no 0.27.4 version. Latest version is 0.27.2

Read more comments on GitHub >

github_iconTop Results From Across the Web

Uncaught TypeError: Cannot read property 'call' of undefined ...
1) What is causing this error? 2) Why is it only being caused in dev mode but not production mode? Update. My code...
Read more >
Cannot Read Property of Undefined in JavaScript - Rollbar
TypeError: Cannot read property of undefined occurs when a property is read or a function is called on an undefined variable.
Read more >
Uncaught TypeError: Cannot read property of undefined In
Uncaught TypeError: Cannot read property of undefined error occurs in Chrome when you read a property or call a method on an undefined...
Read more >
How to Prevent the TypeError: Cannot Read Property Map of ...
A guide on the root cause of 'cannot read map of undefined' as well as techniques and tools to prevent this error.
Read more >
How to Avoid the Infamous "Cannot read properties of ... - Bitovi
With TypeScript, there are two ways of interpreting null and undefined ... avoid the 'Cannot read properties of undefined' runtime TypeError.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found