Skip to content
This repository was archived by the owner on Feb 4, 2022. It is now read-only.
This repository was archived by the owner on Feb 4, 2022. It is now read-only.

argument str must be a string on nuxt server persist #398

@iliapisaniy

Description

@iliapisaniy
  • vuex-persistedstate version: ^4.0.0-beta.3
  • node version: v10.19.0
  • npm (or yarn) version: npm v16.14.4

What you did: Install package and use default plugin from readme (nuxt cookie server persist)

What happened: If no cookie set (example on first page loading).

if (process.server) {
     const parsedCookies = cookie.parse(req.headers.cookie);
     return parsedCookies[key];
}

throws type error argument str must be a string

Reproduction sandbox:

Problem description: cookie package receive string as first parameter but undefined given on empty cookie in browser

Suggested solution: Check is request.headers.cookie is string and set it to blank if not

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions