Firebase firestore not working with Angular universal
I'm trying with Server Side Rendering on Angular follow the instruction from https://angular.io/guide/universal.
At step 5, when trying to run npm run build:ssr && npm run serve:ssr i got the error like this:
TypeError: Cannot read property 'stringify' of undefined
at Object.<anonymous> (/.../dist/server.js:162338:308)
at __webpack_require__ (/.../dist/server.js:20:30)
After taking a look on that line, i found it came from:
- node_modules/@firebase/webchannel-wrapper/dist -> index.js and index.esm.js
- node_modules/firebase/firebase-firestore.js.map
I tried with both firebase 5.6.0 and the latest version 5.7.2 but still got same error.
Here is some more info about my project: angular 6, firebase 5.6.0, angular cli 6.1.0
Did you got into the same issues or have any suggestion to solve this please?
Update
- After trying to remove firebase from my project, it can be builed and work properly.
angular firebase angular-universal
add a comment |
I'm trying with Server Side Rendering on Angular follow the instruction from https://angular.io/guide/universal.
At step 5, when trying to run npm run build:ssr && npm run serve:ssr i got the error like this:
TypeError: Cannot read property 'stringify' of undefined
at Object.<anonymous> (/.../dist/server.js:162338:308)
at __webpack_require__ (/.../dist/server.js:20:30)
After taking a look on that line, i found it came from:
- node_modules/@firebase/webchannel-wrapper/dist -> index.js and index.esm.js
- node_modules/firebase/firebase-firestore.js.map
I tried with both firebase 5.6.0 and the latest version 5.7.2 but still got same error.
Here is some more info about my project: angular 6, firebase 5.6.0, angular cli 6.1.0
Did you got into the same issues or have any suggestion to solve this please?
Update
- After trying to remove firebase from my project, it can be builed and work properly.
angular firebase angular-universal
Did you check the code where you apply stringify function ? Error is showing in server.js file
– DAN
Jan 1 at 11:35
It's not from my code, as i mentioned above it's from firebase. (or i might wrong but i can make sure that it not from my code)
– Lạng Hoàng
Jan 1 at 11:54
Error says about stringify of undefined . That means some json data is expected before stringify. Please check your code. Or check is there any api error on console. Not Sure
– DAN
Jan 1 at 14:02
@DAN as my question, it was in firebase library, after removing firebase from my project it works :|.
– Lạng Hoàng
Jan 1 at 14:23
add a comment |
I'm trying with Server Side Rendering on Angular follow the instruction from https://angular.io/guide/universal.
At step 5, when trying to run npm run build:ssr && npm run serve:ssr i got the error like this:
TypeError: Cannot read property 'stringify' of undefined
at Object.<anonymous> (/.../dist/server.js:162338:308)
at __webpack_require__ (/.../dist/server.js:20:30)
After taking a look on that line, i found it came from:
- node_modules/@firebase/webchannel-wrapper/dist -> index.js and index.esm.js
- node_modules/firebase/firebase-firestore.js.map
I tried with both firebase 5.6.0 and the latest version 5.7.2 but still got same error.
Here is some more info about my project: angular 6, firebase 5.6.0, angular cli 6.1.0
Did you got into the same issues or have any suggestion to solve this please?
Update
- After trying to remove firebase from my project, it can be builed and work properly.
angular firebase angular-universal
I'm trying with Server Side Rendering on Angular follow the instruction from https://angular.io/guide/universal.
At step 5, when trying to run npm run build:ssr && npm run serve:ssr i got the error like this:
TypeError: Cannot read property 'stringify' of undefined
at Object.<anonymous> (/.../dist/server.js:162338:308)
at __webpack_require__ (/.../dist/server.js:20:30)
After taking a look on that line, i found it came from:
- node_modules/@firebase/webchannel-wrapper/dist -> index.js and index.esm.js
- node_modules/firebase/firebase-firestore.js.map
I tried with both firebase 5.6.0 and the latest version 5.7.2 but still got same error.
Here is some more info about my project: angular 6, firebase 5.6.0, angular cli 6.1.0
Did you got into the same issues or have any suggestion to solve this please?
Update
- After trying to remove firebase from my project, it can be builed and work properly.
angular firebase angular-universal
angular firebase angular-universal
edited Jan 2 at 1:13
Lạng Hoàng
asked Jan 1 at 10:51
Lạng HoàngLạng Hoàng
8553929
8553929
Did you check the code where you apply stringify function ? Error is showing in server.js file
– DAN
Jan 1 at 11:35
It's not from my code, as i mentioned above it's from firebase. (or i might wrong but i can make sure that it not from my code)
– Lạng Hoàng
Jan 1 at 11:54
Error says about stringify of undefined . That means some json data is expected before stringify. Please check your code. Or check is there any api error on console. Not Sure
– DAN
Jan 1 at 14:02
@DAN as my question, it was in firebase library, after removing firebase from my project it works :|.
– Lạng Hoàng
Jan 1 at 14:23
add a comment |
Did you check the code where you apply stringify function ? Error is showing in server.js file
– DAN
Jan 1 at 11:35
It's not from my code, as i mentioned above it's from firebase. (or i might wrong but i can make sure that it not from my code)
– Lạng Hoàng
Jan 1 at 11:54
Error says about stringify of undefined . That means some json data is expected before stringify. Please check your code. Or check is there any api error on console. Not Sure
– DAN
Jan 1 at 14:02
@DAN as my question, it was in firebase library, after removing firebase from my project it works :|.
– Lạng Hoàng
Jan 1 at 14:23
Did you check the code where you apply stringify function ? Error is showing in server.js file
– DAN
Jan 1 at 11:35
Did you check the code where you apply stringify function ? Error is showing in server.js file
– DAN
Jan 1 at 11:35
It's not from my code, as i mentioned above it's from firebase. (or i might wrong but i can make sure that it not from my code)
– Lạng Hoàng
Jan 1 at 11:54
It's not from my code, as i mentioned above it's from firebase. (or i might wrong but i can make sure that it not from my code)
– Lạng Hoàng
Jan 1 at 11:54
Error says about stringify of undefined . That means some json data is expected before stringify. Please check your code. Or check is there any api error on console. Not Sure
– DAN
Jan 1 at 14:02
Error says about stringify of undefined . That means some json data is expected before stringify. Please check your code. Or check is there any api error on console. Not Sure
– DAN
Jan 1 at 14:02
@DAN as my question, it was in firebase library, after removing firebase from my project it works :|.
– Lạng Hoàng
Jan 1 at 14:23
@DAN as my question, it was in firebase library, after removing firebase from my project it works :|.
– Lạng Hoàng
Jan 1 at 14:23
add a comment |
1 Answer
1
active
oldest
votes
For who got into the same issue like this, please take a look on this link for a detail answer.
Basically, the instruction in this link seems not updated, because the code in the provided repo is quite diffirent and more important that it works even with firestore.
I did clone the repo and then tried to add firestore on it and everything just worked properly. So, now you have two choices: go with the instruction and apply the fix from @Feiyang1 on the given link above OR just clone the repo and checkout the way they implement SSR.
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53994844%2ffirebase-firestore-not-working-with-angular-universal%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
For who got into the same issue like this, please take a look on this link for a detail answer.
Basically, the instruction in this link seems not updated, because the code in the provided repo is quite diffirent and more important that it works even with firestore.
I did clone the repo and then tried to add firestore on it and everything just worked properly. So, now you have two choices: go with the instruction and apply the fix from @Feiyang1 on the given link above OR just clone the repo and checkout the way they implement SSR.
add a comment |
For who got into the same issue like this, please take a look on this link for a detail answer.
Basically, the instruction in this link seems not updated, because the code in the provided repo is quite diffirent and more important that it works even with firestore.
I did clone the repo and then tried to add firestore on it and everything just worked properly. So, now you have two choices: go with the instruction and apply the fix from @Feiyang1 on the given link above OR just clone the repo and checkout the way they implement SSR.
add a comment |
For who got into the same issue like this, please take a look on this link for a detail answer.
Basically, the instruction in this link seems not updated, because the code in the provided repo is quite diffirent and more important that it works even with firestore.
I did clone the repo and then tried to add firestore on it and everything just worked properly. So, now you have two choices: go with the instruction and apply the fix from @Feiyang1 on the given link above OR just clone the repo and checkout the way they implement SSR.
For who got into the same issue like this, please take a look on this link for a detail answer.
Basically, the instruction in this link seems not updated, because the code in the provided repo is quite diffirent and more important that it works even with firestore.
I did clone the repo and then tried to add firestore on it and everything just worked properly. So, now you have two choices: go with the instruction and apply the fix from @Feiyang1 on the given link above OR just clone the repo and checkout the way they implement SSR.
answered Jan 22 at 2:33
Lạng HoàngLạng Hoàng
8553929
8553929
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53994844%2ffirebase-firestore-not-working-with-angular-universal%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Did you check the code where you apply stringify function ? Error is showing in server.js file
– DAN
Jan 1 at 11:35
It's not from my code, as i mentioned above it's from firebase. (or i might wrong but i can make sure that it not from my code)
– Lạng Hoàng
Jan 1 at 11:54
Error says about stringify of undefined . That means some json data is expected before stringify. Please check your code. Or check is there any api error on console. Not Sure
– DAN
Jan 1 at 14:02
@DAN as my question, it was in firebase library, after removing firebase from my project it works :|.
– Lạng Hoàng
Jan 1 at 14:23