Firebase firestore not working with Angular universal












2















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.










share|improve this question

























  • 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
















2















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.










share|improve this question

























  • 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














2












2








2


1






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.










share|improve this question
















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






share|improve this question















share|improve this question













share|improve this question




share|improve this question








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



















  • 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












1 Answer
1






active

oldest

votes


















0














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.






share|improve this answer























    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
    });


    }
    });














    draft saved

    draft discarded


















    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









    0














    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.






    share|improve this answer




























      0














      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.






      share|improve this answer


























        0












        0








        0







        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.






        share|improve this answer













        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.







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Jan 22 at 2:33









        Lạng HoàngLạng Hoàng

        8553929




        8553929
































            draft saved

            draft discarded




















































            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.




            draft saved


            draft discarded














            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





















































            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







            Popular posts from this blog

            Monofisismo

            Angular Downloading a file using contenturl with Basic Authentication

            Olmecas