Skip to content

TypeError: (void 0) is not a function #84

Description

@michaelsw95

When including the Exceptionless client library within my Angular 7 Application, I get a type error on bootstrap when I do a production build (non production builds work fine).

The error is thrown within my app module where I do:

import { ExceptionlessClient } from 'exceptionless';

The actual error appears to happen on line 1280
"webpack:///./node_modules/exceptionless/dist/exceptionless.js.pre-build-optimizer.js".

Here require appears to be throwing the error.

var exports, require;

Removing the exceptionless client library from my application appears to fix the issue but I am not entirely convinced that this is a exceptionless issue.

Has anyone experienced this? Currently I am unable to serve production builds and have exceptionless logging. I have tried modify (updating/downgrading) all angular dependencies but this did not resolve the issue.

Here is my package json, I am using the latest version of the exceptionless client library:

"dependencies": {
    "@angular/animations": "7.2.0",
    "@angular/common": "7.2.0",
    "@angular/compiler": "7.2.0",
    "@angular/core": "7.2.0",
    "@angular/forms": "7.2.0",
    "@angular/http": "7.2.0",
    "@angular/platform-browser": "7.2.0",
    "@angular/platform-browser-dynamic": "7.2.0",
    "@angular/router": "7.2.0",
    "bootstrap": "4.2.1",
    "core-js": "2.6.2",
    "exceptionless": "1.6.0",
    "node-sass": "4.11.0",
    "oidc-client": "1.6.1",
    "rxjs": "6.3.3",
    "zone.js": "0.8.26"
},
"devDependencies": {
    "@angular-devkit/build-angular": "0.12.1",
    "@angular/cli": "7.2.1",
    "@angular/compiler-cli": "7.2.0",
    "@angular/language-service": "7.2.0",
    "@types/node": "10.12.18",
    "@types/jasmine": "3.3.5",
    "@types/jasminewd2": "2.0.6",
    "codelyzer": "4.5.0",
    "jasmine-core": "3.3.0",
    "jasmine-spec-reporter": "4.2.1",
    "karma": "3.1.4",
    "karma-chrome-launcher": "2.2.0",
    "karma-coverage-istanbul-reporter": "2.0.4",
    "karma-jasmine": "2.0.1",
    "karma-jasmine-html-reporter": "1.4.0",
    "protractor": "5.4.2",
    "ts-node": "7.0.1",
   "tslint": "5.12.0",
   "typescript": "3.1.1"
 }

Activity

  1. niemyjski commented on Feb 11, 2019

    @niemyjski
    Member

    We also have an angular 7 prod builds for our new website without any issues. Is there nay chance there is a sample starter app that is close to your app that we could try this on? Any chance you could fork it and configure Exceptionless exactly how it is in your app and I'll pull it down and debug it.

  2. niemyjski commented on Feb 11, 2019

    @niemyjski
    Member

    I'm double checking our setup and confirming there are no issues. I have tested this on universal apps without issue I'm wondering what the root issue is.

  3. michaelsw95 commented on Feb 11, 2019

    @michaelsw95
    Author

    Thank you for responding so soon. Unfortunately I don't really have an app I can put on GitHub to demonstrate this but I do have some reproduction steps which you should be able to use to debug it. I have been able to recreate this on a fresh angular project.

    1. ng new Test
    2. Update package.json to match the packages I have listed above
    3. Delete package-lock.json and node_modules
    4. npm i
    5. Update app.module.ts to look like this:
    import { BrowserModule } from '@angular/platform-browser';
    import { NgModule } from '@angular/core';
    
    import { AppComponent } from './app.component';
    import { ExceptionlessClient } from 'exceptionless';
    
    ExceptionlessClient.default.config.apiKey = '';
    ExceptionlessClient.default.config.serverUrl = '';
    ExceptionlessClient.default.config.updateSettingsWhenIdleInterval = -1;
    ExceptionlessClient.default.config.addDataExclusions('ngDebugContext');
    
    @NgModule({
      declarations: [
        AppComponent
      ],
      imports: [
        BrowserModule
      ],
      providers: [],
      bootstrap: [AppComponent]
    })
    export class AppModule { }
    1. ng serve --prod --source-map

    Following these steps I get the following error:

    exceptionless.js.pre-build-optimizer.js:1280 Uncaught TypeError: (void 0) is not a function
        at Object.lYe+ (exceptionless.js.pre-build-optimizer.js:1280)
        at f (bootstrap:78)
        at Module.zUnb (core.js.pre-build-optimizer.js:24324)
        at f (bootstrap:78)
        at Object.0 (events.js.pre-build-optimizer.js:426)
        at f (bootstrap:78)
        at t (bootstrap:45)
        at Array.r [as push] (bootstrap:32)
        at main.ffe2c0e5b2efc269ce1d.js:1
    lYe+ @ exceptionless.js.pre-build-optimizer.js:1280
    f @ bootstrap:78
    zUnb @ core.js.pre-build-optimizer.js:24324
    f @ bootstrap:78
    0 @ events.js.pre-build-optimizer.js:426
    f @ bootstrap:78
    t @ bootstrap:45
    r @ bootstrap:32
    (anonymous) @ main.ffe2c0e5b2efc269ce1d.js:1
    

    This error disappears if I remove the references to ExceptionlessClient.

    Hope this helps.

  4. niemyjski commented on Feb 11, 2019

    @niemyjski
    Member

    We are also seeing this on our end, I noticed the dependency was brought in incorrectly in our app. I'll take a look into this and update this issue.

  5. yuxingz commented on Feb 15, 2019

    @yuxingz

    I also encountered this problem. Is there a solution?

  6. yuxingz commented on Feb 15, 2019

    @yuxingz

    Thank you, I try

  7. niemyjski commented on Feb 15, 2019

    @niemyjski
    Member

    I've fixed this in version 1.6.1, please update and let us know if you run into any issues.

  8. yuxingz commented on Feb 16, 2019

    @yuxingz

    Ok, no problem, thank you very much.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions