projections - A unstamped event found

I’m currently trying a simple proof of concept using the http api to create some events manually and testing out a projection. I have previously managed to get projections working fine writing to streams using the .net client.

I’m currently using eventstore version 2.0.1.0

I am getting the error “A unstamped event found” when posting to the stream the projection is running over after it tries to emit an event. I’m having trouble finding any documentation explaining what this error means or how to resolve it.

The event it refers to is an event posted to the stream via the http api. I’m using postman and posting :

[

{

“eventId”: “abf4b1a1-b4a3-4dfe-a01f-ec52c34e16e4”,

“eventType”: “devicemonitored”,

“data”: {

“imei” : 123,

“occuredAt” : “2014-01-20 23:30:00Z”

}

}

]

``

The projection looks like this

fromCategory(‘devicetest1’)

.foreachStream()

.when({

$init : function () {

return { offair : false };

},

deviceinit : function (s,e)

{

s.initedOn = new Date(e.body.firstSeen);

return s;

},

heartbeat : function (s,e)

{

s.lastHeartbeat = new Date(e.body.occuredAt);

if(s.offair)

{

emit(e.streamId, ‘onair’, { imei : e.body.imei, occuredAt : s.lastHeartbeat}) ;

}

return s;

},

devicemonitored : function (s,e)

{

s.lastMonitored = new Date(e.body.occuredAt);

if(s.lastMonitored - s.lastHeartbeat > 262798250)

{

emit(e.streamId, ‘offair’, { imei : e.body.imei, occuredAt : new Date()});

}

return s;

},

offair : function(s,e)

{

s.offair = true;

s.lastOffair = new Date(e.body.occuredAt);

return s;

},

onair : function(s,e)

{

s.offair = false;

return s;

}

});

``

Thanks

It has to do with the checkpoint.

Is this on a restart or?

Do you mean reset of the projection or restart of the eventstore?

If I remember correctly we first created the projection without emits enabled, then changed it to emit events without resetting.

It then gave us this error. After that we tried resetting it, but I think at this stage we had already borked it up and it carried on giving this message.

Should I just start again? Is there a way to fix this without blowing away the stream?

Thanks for the help

"If I remember correctly we first created the projection without emits
enabled, then changed it to emit events without resetting."

Ah that could be it.

"Should I just start again? Is there a way to fix this without blowing
away the stream?" your original stream or the emitted stream?

An easy way around this would just be to delete the original and post
a new one that writes to a different stream (it will replay the
history and recreate your stream for you)