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
'OpaqueToken', function calls are not supported #843
Comments
Hey @jogelin. Angular 4 is still in RC so we're not going to support it until it's in a full release. The fix is simple, but |
Just upgraded my code base to Angular4, got the below error similar to the above error. ERROR in Error encountered resolving symbol values statically. Calling function 'OpaqueToken', function calls are not supported. Consider replacing the function or lambda with a reference to an exported function, resolving symbol FirebaseUserConfig in _path/node_modules/angularfire2/tokens.d.ts, resolving symbol AngularFireModule.initializeApp in _path/node_modules/angularfire2/angularfire2.d.ts, resolving symbol AppModule in _path/src/app/app.module.ts, resolving symbol AppModule in _path/ajs/src/app/app.module.ts Appreciate any help to resolve this. |
Just to let you know that I have uninstalled firebase and angularfire2 and reinstalled both which fixed the app working. npm uninstall firebase angularfire2 --save |
@ravivit9 thanks for the hint, reinstalling appears to solve the problem for me as well. |
@jogelin yes it is weird. I am running Angular 4.0 now, and gets the same error. Edit any file and recompiles ok. |
@davideast Is there a temporary fix for this which I can use? |
I've reinstalled, but I still get the error. :-/ A temp fix would be much appreciated. Version info Seems that I cannot create a build (to /dist) in an angular-cli project because of this. |
|
I have also reinstalled, but still get the error as well. I'm posting this again because my versions are different: Version info
This runs locally for me just fine, but Travis CI build fails due to error mention above. |
@jakehockey10, just upgraded my code base from 4.0.1 to 4.0.2 as suggested by "ncu" and did ng serve. Now I am also getting the error as stated above. |
@jakehockey10, as I posted in one of the above comment. Please do the following to resolve the issue. It just worked after I uninstalled and installed both firebase and angularfire2. Hope this helps. |
@ravivit9, I had already tried what you are suggested and still can't get it to work |
As I am not sure how Travis build will work. I just managed to make to run in local site only. |
@ravivit, that would be consistent with what I am seeing. I believe there is a version incomparability and it is very difficult to narrow down what the issue is |
Except now I can't get it to work anywhere |
Sorry to hear that, I would suggest remove node_modules directory and then hopefully the above would fix local version at least. But I am not sure about Travis Cli as I never used it myself. Please make sure the global modules are same as the local e.g. firebase, @angular/cli. This is my configuration. Hopefully you will get over this issue. |
@ravivit9 thanks for continuing to look at this with me. I'm still banging my head over here. I've used your setup, removed I'm just baffled. No errors from anything showing up anywhere. If I subscribe to the observable that I'm trying to display in the UI, Firebase is WORKING. It is giving me my messages. I can't print them to the console. It is just the template refusing to show them in the ui... Here is what I have in a nutshell: @Component({
selector: 'app-home',
templateUrl: './home.component.html',
styleUrls: ['./home.component.css']
})
export class HomeComponent {
public newMessage: string;
public messages: FirebaseListObservable<any[]>;
constructor(public authService: AuthenticationService) {
this.messages = this.authService.messages;
this.messages.subscribe(response => console.log(response));
}
...
} <div id="messages">
<div *ngFor="let message of messages | async">
<p>{{message.message}}</p>
<div class="author">
{{message.displayName }} | {{ message.timestamp | date:"MM/dd/yy hh:mm a"}}
</div>
</div>
</div>
<figure class="highlight">
<input type="textarea" class="message-text" [(ngModel)]="newMessage" (keyup.enter)="sendMessage()">
<button md-button class="send-message" (click)="sendMessage()">SEND</button>
</figure> And lastly, what my package.json looks like: "dependencies": {
"@angular/animations": "^4.0.2",
"@angular/common": "^4.0.2",
"@angular/compiler": "^4.0.2",
"@angular/core": "^4.0.2",
"@angular/forms": "^4.0.2",
"@angular/http": "^4.0.2",
"@angular/material": "^2.0.0-beta.3",
"@angular/platform-browser": "^4.0.2",
"@angular/platform-browser-dynamic": "^4.0.2",
"@angular/router": "^4.0.2",
"angularfire2": "^2.0.0-beta.8",
"core-js": "^2.4.1",
"firebase": "^3.7.6",
"hammerjs": "^2.0.8",
"rxjs": "^5.3.0",
"zone.js": "^0.8.5"
},
"devDependencies": {
"@angular/cli": "^1.0.0",
"@angular/compiler-cli": "^4.0.2",
"@types/jasmine": "^2.5.47",
"@types/node": "^7.0.12",
"codelyzer": "^3.0.0-beta.4",
"jasmine-core": "~2.5.2",
"jasmine-spec-reporter": "~3.2.0",
"karma": "^1.6.0",
"karma-chrome-launcher": "~2.0.0",
"karma-cli": "~1.0.1",
"karma-coverage-istanbul-reporter": "^1.1.0",
"karma-jasmine": "~1.1.0",
"karma-jasmine-html-reporter": "^0.2.2",
"protractor": "~5.1.1",
"ts-node": "^3.0.2",
"tslint": "^5.1.0",
"typescript": "^2.2.2"
} I wish I knew how to diagnose these types of issues better. I would like to know what kinds of things this is an indication of and how to dig deeper. But to the point where I'm just trying to change the versions of various packages minimally. But even if I revert back to when I had a successful build on Travis CI, I still can't get it to work locally anymore. I don't know what to point my finger at? |
Also, just a further point, data binding in general is working. It is only data that I (oddly successfully) get from firebase, whether I'm asynchronously letting an observable fill out the ui with the |
I am also doing pretty much the same. @component({ constructor(private authService: AuthService, private router: Router, af: AngularFire) { ngOnInit() {} logout() {
The only line I see the difference is "implements OnInit" |
@ravivit9 okay making progress. Check out this change: export class HomeComponent implements AfterViewChecked {
@ViewChild('scrollMe') private myScrollContainer: ElementRef;
public newMessage: string;
public messages: FirebaseListObservable<any>;
constructor(
public authService: AuthenticationService,
private snackBar: MdSnackBar,
private changeDetector: ChangeDetectorRef // longshot, but I'm getting desperate
) {
this.messages = this.authService.messages;
this.messages.subscribe(response => this.changeDetector.detectChanges());
// That actually friggin' made it work. Why isn't change detection running on its own? Where
// should I look for how I've configured change detection that differs from default behavior?
}
...
} |
We are working on the change and should have a |
@davideast If you have the time, could you explain to me what's going on? I'm just trying to learn this stuff and I think it would help me diagnose these issues in the future. A What change are you referring to in your last comment? What does that change address? Or are you referring to the compatibility with Angular 4.0.x in general? UpdateTo further understand what's going on, I tried to write a test that repeated the behavior I was seeing. Here is what I came up with: // src/app/home/home.component.spec.ts
describe('HomeComponent', () => {
let component: HomeComponent;
let fixture: ComponentFixture<HomeComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
imports: [FormsModule],
declarations: [HomeComponent],
providers: [
{ provide: AuthenticationService, useClass: AuthenticationServiceStub },
...
]
}).compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(HomeComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
...
it('should have messages', async(() => {
// Arrange
const de = fixture.debugElement.query(By.css('#messages'));
const el = de.nativeElement;
// Act
fixture.whenStable().then(() => {
// Assert
expect(el.children.length).toBeGreaterThan(0);
expect(el.children[0].innerText).toContain('hello!');
expect(el.children[0].innerText).toContain('Jake Smith');
expect(el.children[1].innerText).toContain('goodbye!');
expect(el.children[1].innerText).toContain('Bob Saget');
});
})); // src/testing/app.stubs.ts
import { Observable } from 'rxjs/Rx';
export class AuthenticationServiceStub {
public messages: Observable<any> = Observable.of([
{
displayName: 'Jake Smith',
email: 'jakehockey10@gmail.com',
message: 'hello!'
},
{
displayName: 'Bob Saget',
email: 'bob@saget.com',
message: 'goodbye!'
}
])
...
} But I wasn't able to reproduce the problem because it was too difficult for me to mock the firebase service in terms of using a |
@jogelin @jakehockey10 @ravivit9 @LanderBeeuwsaert @zero19 The
|
for me works locally when i do ng Serve but fails in travis CI build with the above error. here's my dependencies: |
this error is frustrating man. |
I have tried reinstalling cleaning and still getting errors stating there is no export, module not found, cant resolve promise-polufill in node_module/firebase/app. Was working about an hour ago and now all the errors keep coming up, causing a potential jump ship to another framework. :/ UPDATE: Was trying an older project and was given this error Unable to find "@angular/cli" in devDependencies. The package "angular-cli" has been deprecated and renamed to "@angular/cli". Please take the following steps to avoid issues: |
Ok so after following what the instructions said in my update. I am able to create a new project and serve it and build. However, I am not able to serve any of the previous projects because there is an issue with firebase and angularfire2. Along with that there the firebase login seems to be broken since you are not able to do Authmethods and AuthProvider. |
After a 2 day struggle it seems the problem in our case was having to adjust to AngularFire's modular split. See #854 and https://github.com/angular/angularfire2/blob/master/docs/Auth-with-Ionic3-Angular4.md
|
Version info
Angular: 4.0.0-rc.1
Firebase: 3.6.9
AngularFire: 2.0.0-beta.8
Angular/cli : 1.0.0-rc.0
When I run my app using
ng serve
, I got this following error :If I modify any file which produce a reload of the build, the error disappear and my app works.
I think it's because the OpaqueToken is deprecated in the new Angular 4.x
The text was updated successfully, but these errors were encountered: