Fatal error when trying to open a stream
Akii opened this issue · comments
For whatever reason, eventstore sends a 401 for any internal projection (e. g. $ce-things). EventStore::ensureStatusCodeIsGood
only checks for 404
and 410
.
GET: http://127.0.0.1:2113/streams/$et-asdf
-> 401
GET: http://127.0.0.1:2113/streams/et-asdf
-> 404
In my opinion, anything that's not 2xx should be considered a failure.
The concrete error:
Catchable Fatal Error: Argument 1 passed to
EventStore\StreamFeed\StreamFeed::__construct() must be of the type
array, null given, called in
[...] EventStore.php
on line 207
I would prefer to be explicit in status code mapping, what other codes may happen?
e.g. 403
Any code may happen. At the moment, those three are the only ones I encountered. I'm all for making things explicit but in this case the RFC has defined those codes, thus making them available to the eventstore to use at any time.
@nicolopignatelli any suggestion about exception name?
we can easily map the status codes we know about, then fallback on a generic error if the status code is not 2xx
+1
I already answered this on twitter but this is not a bug.
$streams (internal streams) require admin access by default (this can be changed by changing the default ACL). See default ACLs http://docs.geteventstore.com/server/3.1.0-pre/access-control-lists/
If you do not send credentials a 401 is quite a reasonable status code to send.
Note that it will send a 401 for any $ prefixed stream without a user.
Thanks for clarifying again. After thinking more about it, it absolutely makes sense.
This should be fixed in master.