Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EventSource enum missing in actual runtime #97

Open
PitchforkAssistant opened this issue Sep 26, 2024 · 0 comments
Open

EventSource enum missing in actual runtime #97

PitchforkAssistant opened this issue Sep 26, 2024 · 0 comments
Labels
bug synced This issue has been added to our internal tracker

Comments

@PitchforkAssistant
Copy link
Contributor

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.

@pl00h pl00h added bug synced This issue has been added to our internal tracker labels Nov 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug synced This issue has been added to our internal tracker
Development

No branches or pull requests

2 participants