Access control - user = undefined #2299
-
Hi! with the access defined as: The read works fine (get request), however all other requet (delete/post/update) fail, since the user somehow ends up undefined for the request object. I checked the session cookie, this one gets send along correctly, so I wonder where the failure might be coming from. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
Forgot to add markdown to the code sections -> Hi!
with the access defined as: The read works fine (get request), however all other requet (delete/post/update) fail, since the user somehow ends up undefined for the request object. I checked the session cookie, this one gets send along correctly, so I wonder where the failure might be coming from. |
Beta Was this translation helpful? Give feedback.
-
Turned out the problem was based on cors issues. |
Beta Was this translation helpful? Give feedback.
Turned out the problem was based on cors issues.
(The dev server ran on the local network & I configured dnsmasq (which is installed on a raspberry pi acting as local dns server) to map the ip to a domain name.
The PAYLOAD_PUBLIC_SERVER_URL in the .env was adapted to match that name, which resolved cors issues for GET requests.
However, for other types (e.g. POST) the issue persisted silenently (no errors indicating cors issue were logged).
As a fix for now I added the domain in the csrf array of the payload.config.ts file. -
in case anybody else runs into a similar situation in the future.