Skip to content
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

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

Closed
MichaelHancock opened this issue Feb 11, 2019 · 8 comments
Closed

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

MichaelHancock opened this issue Feb 11, 2019 · 8 comments

Comments

@MichaelHancock
Copy link

MichaelHancock commented Feb 11, 2019

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"
 }
@niemyjski
Copy link
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.

@niemyjski
Copy link
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.

@MichaelHancock
Copy link
Author

MichaelHancock commented Feb 11, 2019

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.

@niemyjski
Copy link
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.

@yuxingz
Copy link

yuxingz commented Feb 15, 2019

I also encountered this problem. Is there a solution?

@yuxingz
Copy link

yuxingz commented Feb 15, 2019

Thank you, I try

@niemyjski
Copy link
Member

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

@yuxingz
Copy link

yuxingz commented Feb 16, 2019

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
Labels
None yet
Development

No branches or pull requests

3 participants