'emit' is not allowed, but should've been enabled

Hi,
I migrated my event store server (at least one of them) from linux to windows and am now in the process of converting deployment scripts etc.

Part of that is a script that creates necessary projections, but somehow these are not created correctly. Unfortunately, as mentioned in https://groups.google.com/forum/#!topic/event-store/A2YebPk-4ZA , as the projections are currently not visible via the WebUI and I don’t have a full grasp on the complete API, I am having a hard time finding the reason why it doesnt work.

To create the projection, I am using this command:

curl -X POST --user {0} --data “{1}” -v {2}projections/continuous?name=per-context&type=JS&emit=1

A GET request on projections/any shows this output:

{

“coreProcessingTime”: 15,

“version”: 0,

“epoch”: -1,

“effectiveName”: “per-context”,

“writesInProgress”: 0,

“readsInProgress”: 0,

“partitionsCached”: 1,

“status”: “Faulted (Enabled)”,

“stateReason”: “‘emit’ is not allowed by the projection/configuration/mode”,

“name”: “per-context”,

“mode”: “Continuous”,

“position”: “C:0/P:-1”,

“progress”: 100.0,

“lastCheckpoint”: “C:0/P:-1”,

“eventsProcessedAfterRestart”: 0,

“statusUrl”: “http://myIP:2113/projection/per-context”,

“stateUrl”: “http://myIP:2113/projection/per-context/state”,

“resultUrl”: “http://myIP:2113/projection/per-context/result”,

“queryUrl”: “http://myIP:2113/projection/per-context/query%3Fconfig=yes”,

“enableCommandUrl”: “http://myIP:2113/projection/per-context/command/enable”,

“disableCommandUrl”: “http://myIP:2113/projection/per-context/command/disable”,

“checkpointStatus”: “”,

“bufferedEvents”: 0,

“writePendingEventsBeforeCheckpoint”: 0,

“writePendingEventsAfterCheckpoint”: 0

}

``

For some reason, emit is disallowed, even though it’s obviously enabled in the creation request url. The url scheme I used was from https://github.com/EventStore/EventStore/blob/2b0e58f3b336e7d44d983dbadfadd427158c1ba3/src/EventStore.ClientAPI/Projections/ProjectionsClient.cs line 45, so should be correct.

I’m pretty sure this is something very trivial (and easier to find would the WebUI work :wink: ), but somehow it isn’t coming to me.

Thanks,

Nicolas

Are you running with --run-projections=all? Have you tried clearing your browser cache and/or refreshing the page? There’s no reason that projections shouldn’t be displayed in the UI if they’re enabled.

Oh, looks like this actually was a regression - if you replace the UI with the one from the EventStore.UI master branch it will come back to life.

Yes I’m running with --run-projections=all.

While it’s nice to have the WebUI again, it only confirmed that the “Emit enabled” setting is indeed unchecked.

Unfortunately I still need the scripted creation of the projection to work. The url that is stated in the first post should work, correct?

I noticed in the source code that there is another parameter, “enabled”, that comes before emit, but it isn’t clear if that one is optional and even after adding it it didn’t change anything.

well, seems like all that was missing were missing double quotes around the url :wink: Emit is now enabled and everything works fine.

Oh, yes depending on your shell it may interpret parts of URL as parameters to cURL - not much we can do about this!

There will be another release shortly (3.0.6 I guess) with a number of fixes for common projections issues, and this UI regression will be included there.