The PostDelete event contains a source property of the type EventSource. It's exported and available to import from @devvit/protos, but the runtime doesn't seem to match that.
The following code is valid, builds, and uploads:
import {EventSource, PostDelete} from "@devvit/protos";
import {TriggerContext} from "@devvit/public-api";
export async function onPostDelete (event: PostDelete, context: TriggerContext) {
if (event.source !== EventSource.USER) {
return;
}
// handle user deletion...
console.log(`Processing user deletion of ${event.postId}`);
}
However it fails when actually running on Devvit with the error: TypeError: Cannot read properties of undefined (reading 'USER')
This wasn't always the case and is affecting apps that were previously referencing the enum without issues. I am not sure when it went missing, but it was still there a few months ago.
The
PostDelete
event contains a source property of the typeEventSource
. It's exported and available to import from@devvit/protos
, but the runtime doesn't seem to match that.The following code is valid, builds, and uploads:
However it fails when actually running on Devvit with the error:
TypeError: Cannot read properties of undefined (reading 'USER')
This wasn't always the case and is affecting apps that were previously referencing the enum without issues. I am not sure when it went missing, but it was still there a few months ago.