Auth-module: Headers Not found

Created on 5 Apr 2018  路  3Comments  路  Source: nuxt-community/auth-module

When I do

$> yarn generate 

I got an error in the storage file.
```ROUTE /

TypeError: Cannot read property 'headers' of undefined

  • server-bundle.js:4195 Storage.getCookie
    server-bundle.js:4195:63

  • server-bundle.js:4045 Storage.getUniversal
    server-bundle.js:4045:20

  • server-bundle.js:4057 Storage.syncUniversal
    server-bundle.js:4057:22

  • server-bundle.js:3709 Auth.init
    server-bundle.js:3709:19

  • server-bundle.js:3652 module.exports.__webpack_exports__.a
    server-bundle.js:3652:16

  • server-bundle.js:1545 createApp
    server-bundle.js:1545:199


it seems issue in storage.js file.

const cookieStr = process.browser
? document.cookie
: this.ctx.req.headers.cookie
```

question

Most helpful comment

Hi @essamamdani. If you have a dynamic website with authentication enabled, i think the best way would be to use spa mode (nuxt build --spa --generate)

All 3 comments

@pi0 Can you answer this? I am stuck with that.

Hi @essamamdani. If you have a dynamic website with authentication enabled, i think the best way would be to use spa mode (nuxt build --spa --generate)

Thank you @pi0. You are the man.

Was this page helpful?
0 / 5 - 0 ratings