Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Module has no exported member REQUEST. Is the documentation outdated for SSR? #345

Closed
AhsanAyaz opened this issue Mar 7, 2025 · 4 comments
Assignees

Comments

@AhsanAyaz
Copy link

Describe the bug

The Readme says that we should import this:

import { REQUEST as SSR_REQUEST } from 'ngx-cookie-service-ssr'

However, it throws the error:

Image

Steps to Reproduce

Install the latest package, paste the line in server.ts:

import { REQUEST as SSR_REQUEST } from 'ngx-cookie-service-ssr'

Please provide a link to a minimal reproduction of the bug. StackBlitz, CodePen or CodeSanBox

Expected behaviour

I would assume the library exports REQUEST.
If not, the documentation probably needs to be updated.

What version of the library you see this issue?

19.1.2

What version of Angular are you using?

Angular 19

Screenshots

No response

Desktop? Please complete the following information

Mac OS Sonoma

Mobile? Please complete the following information

No response

Anything else?

No response

Copy link

github-actions bot commented Mar 7, 2025

Hello 👋 @AhsanAyaz
Thank you for raising an issue. We will investigate into the issue and get back to you as soon as possible. Please make sure you have given us as much context as possible.
Feel free to raise a PR if you can fix the issue

@AhsanAyaz AhsanAyaz changed the title Module has no exported member REQUEST. Is the documentation outdated? Module has no exported member REQUEST. Is the documentation outdated for SSR? Mar 7, 2025
@pavankjadda
Copy link
Collaborator

Updated the README.md

@kewur
Copy link

kewur commented Mar 7, 2025

I might be wrong but on this line here you're injecting the type REQUEST from angular/core

https://github.com/stevermeister/ngx-cookie-service/blob/master/projects/ngx-cookie-service-ssr/src/lib/ssr-cookie.service.ts#L2

However, on the readme we're using the string 'REQUEST' instead, which doesnt actually bind to the cookies. So my cookies are actually empty in ssr (because it's looking at the wrong thing) when I use string 'REQUEST' however if I use the type, then it crashes with

TypeError: this.request?.headers.get is not a function
    at t.check 

I've confirmed that ssr gets the cookies by printing

console.log('Cookies on SSR:', req.headers.cookie);

and I'm at the same time on my AuthGuard printing .getAll() from my ngx-cookies-ssr service which returns empty

{}

Is it possible there's a bug here or am I setting this up incorrectly. The way on the readme def doesnt work for me, and if I go by the code then I get a crash on Angular 19. This wasnt crashing in Angular 18 mind you

@pavankjadda
Copy link
Collaborator

I might be wrong but on this line here you're injecting the type REQUEST from angular/core

https://github.com/stevermeister/ngx-cookie-service/blob/master/projects/ngx-cookie-service-ssr/src/lib/ssr-cookie.service.ts#L2

However, on the readme we're using the string 'REQUEST' instead, which doesnt actually bind to the cookies. So my cookies are actually empty in ssr (because it's looking at the wrong thing) when I use string 'REQUEST' however if I use the type, then it crashes with

TypeError: this.request?.headers.get is not a function
    at t.check 

I've confirmed that ssr gets the cookies by printing

console.log('Cookies on SSR:', req.headers.cookie);

and I'm at the same time on my AuthGuard printing .getAll() from my ngx-cookies-ssr service which returns empty

{}

Is it possible there's a bug here or am I setting this up incorrectly. The way on the readme def doesnt work for me, and if I go by the code then I get a crash on Angular 19. This wasnt crashing in Angular 18 mind you

Could you share a stack blitz example?

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

No branches or pull requests

3 participants