Titanium JIRA Archive
Appcelerator Community (AC)

[AC-6554] Android: TypeError: originalRequire is not a function

GitHub Issuen/a
TypeBug
Priorityn/a
StatusOpen
ResolutionUnresolved
Affected Version/sn/a
Fix Version/sn/a
ComponentsTitanium SDK & CLI
Labelsn/a
ReporterMichiel van Eerd
AssigneeAbir Mukherjee
Created2020-06-05T13:16:09.000+0000
Updated2021-02-10T10:13:14.000+0000

Description

I use the [bencoding.AlarmManager Module](https://github.com/benbahrenburg/benCoding.AlarmManager) to schedule notifications. Everything is fine when I schedule those notifications from within the app, for example after a button click. When I click a notification, the app starts fine. But when I schedule those notifications in a service after the BOOT_COMPLETED event, the notifications are still being displayed, but when I click on them, I see the splash screen of my app and then the below error:
    TypeError: originalRequire is not a function
        at global.require (<embedded>:19311:10)
        at <embedded>:19571:3
        at loadAsync (<embedded>:19497:5)
        at _startSnapshot (<embedded>:19568:1)
        at /ti.main.js:1:98
        at Module._runScript (ti:/module.js:587:9)
        at Module.load (ti:/module.js:106:7)
        at Function.Module.runModule (ti:/module.js:74:9)
    
        org.appcelerator.kroll.runtime.v8.V8Runtime.nativeRunModule(Native Method)
        org.appcelerator.kroll.runtime.v8.V8Runtime.doRunModule(V8Runtime.java:174)
        org.appcelerator.titanium.TiApplication.launch(TiApplication.java:791)
        org.appcelerator.titanium.TiLaunchActivity.loadScript(TiLaunchActivity.java:98)
        org.appcelerator.titanium.TiRootActivity.loadScript(TiRootActivity.java:480)
        org.appcelerator.titanium.TiLaunchActivity.onResume(TiLaunchActivity.java:179)
        org.appcelerator.titanium.TiRootActivity.onResume(TiRootActivity.java:499)
        android.app.Instrumentation.callActivityOnResume(Instrumentation.java:1446)
        android.app.Activity.performResume(Activity.java:7939)
        android.app.ActivityThread.performResumeActivity(ActivityThread.java:4195)
It seems this happens randomly. I realised this happens since I compile this module with SDK 9.0.2.GA. If I use the old module binary everything works fine. On [Stackoverflow](https://stackoverflow.com/questions/61951894/getting-originalrequire-is-not-a-function-when-using-bencoding-alarmmanager-in) there is another one who experiences this with SDK 9 (but not with SDK 8.3.0).

Comments

  1. Michiel van Eerd 2020-06-06

    I cannot delete this issue, but I'm investigating this a little further, so you can leave this issue for what it is.
  2. Michiel van Eerd 2020-06-06

    FYI: After I downgraded from Node v12.X to v10.21.0 it looks like everything is working fine. This issue can be closed.
  3. Tatsuya Kurosawa 2020-10-13

    I'm having the same bug and I'm in trouble. Is there any countermeasure? Node.js is v10.21.0. SDK version is 9.2.1, and all 9.x series had problems.
  4. Jack Lee 2021-02-10

    I also having the same problem when using the SDK 9.3.1. Got the same error message after alarmManager Module started in the background service. Any updates on this issue? Environment Info: NodeJS - v12.19.0 Titanium SDK - 9.3.1 GA Android NDK - android-ndk-r21e android.buildTools.selectedVersion = "30.0.0.2" android.platformTools.selectedVersion = "30.0.0.2 Tested Devices: Google Pixel 3 Android 11 Samsung S10+ Android 10 Samsung S8 Android 8 Samsung J7 Android 8.1.0
  5. Michael Gangolf 2021-02-10

    [~jack.lee] keep in mind that the orignal repo is archived and 3years+ old! If you want to use the module (which might not work) please at least test one of the forks like https://github.com/brentonhouse/benCoding.AlarmManager/ Also: did you try the solution above to downgrade node?

JSON Source