Skip to content
This repository was archived by the owner on Aug 21, 2020. It is now read-only.
This repository was archived by the owner on Aug 21, 2020. It is now read-only.

Issue with Universal Support and CookieBackendService #48

Open

Description

@Loni2Shoes

I am tying to add this library to a universal-enabled project, using the Universal Support instructions.

The two module-level import statements suggested for use are:

import { CookieService } from 'angular2-cookie/services/cookies.service';
import { CookieBackendService } from 'angular2-cookie/services/cookies.backend.service';

with providers supplied in the following way:

providers: [
    {
      provide: CookieService,
      useClass: CookieBackendService
    }

However, this results in the following error:

Exception: Call to Node module failed with error: TypeError: Cannot read property 'headers' of undefined at CookieBackendService.get [as cookieString]

Is there anything else that I need to configure to get his working with Universal?

Activity

  1. jzahka commented on Apr 14, 2017

    @jzahka

    @Loni2Shoes did you figure out what causes this?

  2. Skillnter commented on Apr 22, 2017

    @Skillnter

    Anyone is working on this?

  3. crebuh commented on May 2, 2017

    @crebuh

    have the same problem, but just when I'm using lazy loaded modules in my project

  4. jzahka commented on May 2, 2017

    @jzahka

    From what I can tell this error stems from how you provide request and response in your express engine. The example in the angular universal repo makes them available as injectable tokens https://github.com/angular/universal/tree/master/modules/ng-express-engine#using-the-request-and-response

    I've forked ngx-cookie (the new version of angular2-cookie) to use these injected tokens jzahka/ngx-cookie@d5bc30c#diff-93b0490d252f26a870ada20b3b97cbddR9

  5. JKetelaar commented on May 18, 2017

    @JKetelaar

    I have the same issue, any progress or solution to this?

  6. crebuh commented on Jun 20, 2017

    @crebuh

    @jzahka

    which angular universal repo do you mean? the starter? I can't find anything related to cookies there

  7. crebuh commented on Jul 19, 2017

    @crebuh

    I now upgraded my universal-starter project from 2.x to 4.0.0 and also upgraded the angular2-cookie to the ngx-cookie but still have the same problem not sure how to solve this issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions