-
-
Notifications
You must be signed in to change notification settings - Fork 91
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
Angular v17 SSR - InjectionToken for REQUEST/RESPONSE not working? #292
Comments
Hello 👋 @Shamshiel |
I think the issue is that the code uses a non-exported |
@Shamshiel Can you share stackblitz reproduction? |
@Shamshiel create new issue by following issue template and stackblitz reproduction |
Any news in this problem? I can't access my cookies in the SSR of Angular 17. |
No. I am able to access them in my code. Can you share an example where you can't access them? |
When you use a Guard and try to access the cookie when does SSR, it returns null the "req" Injection. |
Any news in this problem |
@oriollpz @zozjo @Shamshiel @jnizet Can you try version |
I haven't tried your RC but I fixed the issue by just copying your
and then importing it in the server.ts like this:
So the issue is that in v17.0.0 of this library the InjectionToken is not exported. Just using the token 'REQUEST' does not work. I guess the RC would work if SSR_REQUEST is the actual exported InjectionToken for REQUEST. |
Fixed in version |
@xalidevxx See updated docs https://github.com/stevermeister/ngx-cookie-service?tab=readme-ov-file#server-side-rendering. You need to import |
I added the request as in the documentation. Then I built the project and run the production version locally. I output cookieService.get('lang') in app.component.html. As a result:
I expect the server version and browser version to should be the same. Is this how it should work? |
Hi! Can you help me please? |
News about this issue? Still got same behaviour on latest release |
Hi! I didn't find a solution and left it like that. |
All, I am looking at this. Stay tuned. |
Might be related angular/angular-cli#26323 |
is there any news guys? I'm facing the same issue |
Stumbled upon this issue as well. would be amazing to have it fixed :) |
Any fixes yet? |
Guys issue is related to angular/angular-cli#26323, while running ng serve it wont work unless in angular v19. You need to |
See comment for resolution
Either I'm doing something wrong or cookies can't be retrieved from request headers via the SsrCookieService. It seems that SsrCookieService is not able to retrieve the request from the providers.
I have the server.ts and my guard like described below but the bearer token can't be retrieved. I checked the incoming request in the server and the cookie is available in the header. So I assume the request is for some reason not correctly provided to the SsrCookieService.
Is that a bug or am I doing something wrong?
server.ts
Guard
Specifications
The text was updated successfully, but these errors were encountered: