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

Cookie set on server cannot be read on server returns undefined. #387

Open
Muzummil opened this issue Oct 18, 2021 · 4 comments
Open

Cookie set on server cannot be read on server returns undefined. #387

Muzummil opened this issue Oct 18, 2021 · 4 comments
Labels

Comments

@Muzummil
Copy link

Description
Cookies saved on angular SSR are returned as undefined while values are there in browser cookies. This is happening only on the HTTPS site with localhost everything is working as expected.

To Reproduce
Steps to reproduce the behavior:

  1. Save cookies on the server-side and use them on the server-side also and you will get the undefined value.

Environment:

  • Angular version [11]
  • Angular Universal version [11]
  • ngx-cookie : ["^5.0.2"],
  • ngx-cookie-backend: ["^5.0.2"]
@Muzummil Muzummil added the bug label Oct 18, 2021
@bamma
Copy link

bamma commented Nov 3, 2021

Based on skimming the source code. Its because when you set a cookie on SSR you set it to the response object. When you read cookies the service reads from the request object.

@nicholasconfer
Copy link

The issue I created #465 may be duplicate, although the issue I'm experiencing is also running SSR in dev on localhost. Its possible if the localhost run being processed was not using SSR, that the experience would work. This is why it could potentially be a duplicate issue.

Additionally the issue may have been tough to track down without knowing multiple cookies on a domain needed to be set.

Repository owner deleted a comment from pavankjadda Jun 30, 2022
@salemdar
Copy link
Owner

@Muzummil can you recheck with 6.0.1?

@selected-pixel-jameson
Copy link

@salemdar It seems as if 6.0.1 has fixed this issue.

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

No branches or pull requests

5 participants