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

Ping interaction fails when using post callbacks option #626

Closed
fbrettnich opened this issue Dec 16, 2024 · 1 comment
Closed

Ping interaction fails when using post callbacks option #626

fbrettnich opened this issue Dec 16, 2024 · 1 comment
Labels
type: bug Something isn't working

Comments

@fbrettnich
Copy link
Contributor

As soon as the option postCallbacks is set to true, PING requests (Interaction Type 1) for HTTP Interactions can no longer be verified by Discord, as it is currently not possible to respond to PING interactions via the callback endpoint, instead it is required to respond directly to the request with status 200 and PONG (Interaction Callback Type 1) (Docs).

I have already opened a Discord issue (discord/discord-api-docs#7311) for this, but it is unclear if and when this will be changed.

For now, PING interactions should always be answered directly, even if postCallbacks is set to true.


2024-12-16 12:48:52  Got request
2024-12-16 12:48:52  Raw Request: Type 1, ID 1318183058574413864, Token aW50ZXJhY3Rpb246MTMx...VElYYnJVd3JrcTdpTmlFcEVZQVkzWQ
2024-12-16 12:48:52  Respond with Status 202
2024-12-16 12:48:52  Raw REST: POST 404 https://discord.com/api/v10/interactions/aW50ZXJhY3Rpb246MTMx...VElYYnJVd3JrcTdpTmlFcEVZQVkzWQ/callback?with_response=true
2024-12-16 12:48:52  POST /interactions/:id/:token/callback (POST:/interactions/:id/:token/callback:global) 404: 153ms | 1/1 left | Reset 1734349732857 (0ms left)

slash-create/src/creator.ts

Lines 567 to 585 in a6c1ac7

if (this.options.postCallbacks && respond)
await respond({
status: 202
});
if (!respond || !webserverMode || this.options.postCallbacks)
respond = this._createGatewayRespond(interaction.id, interaction.token);
switch (interaction.type) {
case InteractionType.PING: {
this.emit('debug', 'Ping received');
this.emit('ping', interaction.user);
return respond({
status: 200,
body: {
type: InteractionResponseType.PONG
}
});
}

@Snazzah Snazzah added the type: bug Something isn't working label Dec 17, 2024
@Snazzah
Copy link
Owner

Snazzah commented Dec 17, 2024

Kinda surprised this didn't give me issues in development.

Edit: Discord labeled this as a bug (as it is a valid callback), but since posting pings is pretty unnecessary, I'll change this behavior anyways.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants