Session Not Found Error on Custom Event
Thank you a mllion times for this awesome piece of software. I'm currently trying it out with an integration with a Vue 2 app via self-hosting. I'm handling page view events manually and that's working smoothly. However, custom events return 400 errors. A sample Prisme log looks like this:
{"v":0,"pid":1,"hostname":"a577eb75d135","name":"access_log","request_id":"a12a7bd0c80f279dae2a349e10be4dc4","duration_ms":3000.231128,"source_ip":"xxx, xxx","method":"POST","path":"/api/v1/events/custom/Completed","status_code":400,"error":"session not found","level":50,"time":"2025-03-23T16:20:37Z","msg":"request handled"}
Please do you have any idea what the issue might be?
My investigation into the source code doesn't reveal much. Before the custom event is sent, they have been other successful page view events. So, I guess there is a session. Or which other session does it require for custom events?
If the session is computed via the IP address, could having a dual IP address in the source_ip be an issue? The logs seems to have the same IP address listed twice within source_ip.
Hey, sorry for the late response. Sessions are linked to User-Agent header, IP address, Host header AND path. You must send pageview event before (or concurrenlty) triggering custom events otherwise, it won't find the associated session. This is needed as a user can have multiple session (up to 64 by default).
Note: IP address is extracted from X-Forwarded-For if you configured Prisme with PRISME_TRUST_PROXY=true.
mmmh, i recently found a bug in my analytics script (fixed in 717bcd6ff3482253e40b43723cd6c81c6f45a015), this was probably thr source of your issue...
It is fixed and will be part of v0.21.
Thank you for your response and fix.