Comments (6)
Discord does not send a body of [object EventEmitter]
. Can you come up with less complex repro steps so we can eliminate all of these frameworks?
from discord-api-docs.
Ive tested this out without hono just using raw nextjs api functions and still got the same result, going to test it out with the default bun server next
from discord-api-docs.
Bun.serve({
fetch(req) {
console.log('content-type', req.headers.get('content-type'))
console.log('body', req.body)
console.log('method', req.method)
return Response.json({
test: 1
})
},
port: 3000
})
Still gives the same response:
For some reason discord is giving back a ReadableStream thats literally just [object EventEmitter]
when turned into text. Instead of actual json like its supposed to.
Theres a possibility this could be a ngrok problem but I doubt it.
from discord-api-docs.
Can you please provide the actual text of the body? A ReadableStream
is expected.
from discord-api-docs.
This is the expected behavior, since Bun uses the Web specification of Request
. So Request#body
is of type ReadableStream
.
If you want the JSON body of the request, you must use Request#json
.
Bun.serve({
async fetch(req) {
console.log('content-type', req.headers.get('content-type'))
- console.log('body', req.body)
+ console.log('body', await req.json())
console.log('method', req.method)
return Response.json({
test: 1
})
},
port: 3000
})
from discord-api-docs.
This fixes it, so i'm assuming this isn't a problem with discord, probably hono/nextjs. Thanks. (ill post edit this post with a solution if anyone else encounters this)
EDIT: for some reason running nextjs with bun via bun --bun dev
totally breaks nextjs api routes. Removing the --bun seems to fix it. Probably need to post an issue on nextjs at some point
from discord-api-docs.
Related Issues (20)
- User Tags containing IDs not accessible on Mobile Apps
- `banner` and `accent_color` are always `null` on a message author via REST HOT 9
- Permissions in message update event sent as a number HOT 5
- Execute Webhook with Poll object HTTP 403 HOT 3
- Polls not finalizing? HOT 2
- /users/:id returns 404 on users with no mutual guilds HOT 8
- New text channel activities doesn't work in my server HOT 7
- Upgrade button missing on premium app user profile HOT 1
- Locking a thread before a user app can respond results in unavoidable error
- Ending an reoccurring event send the Scheduled event status?
- Slash command options not appearing HOT 5
- Modify Guild Onboarding parameters are all optional, but documented as required
- Add Guild Member endpoint erroneously returns 400
- Game SDK - main discord app running but no user logged in causes game to crash
- Cannot vote on poll in ephemeral message HOT 1
- Changing Server Insights "Weekly to Daily" doesn't work on the first change HOT 1
- Onboarding Audit Log event type 165 ONBOARDING_PROMPT_DELETE never logged
- Canary and PTB Developer Portals give error messages HOT 1
- Role Select Menu is missing guild default role HOT 3
- Selectmenu description is not fully shown in the client
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from discord-api-docs.