Hi, I'm trying to test a piece of code and I can't figure out what I'm doing wrong. I've reduced the deployed main to just this
export default async ({ req, res, log, error }: any) => {
log(Date.now())
log(JSON.stringify(req, null, 2))
}
to debug. I'm trying to run an execution from the web console. Ive tried:
- setting/unsetting the
content-type: application/jsonheader - body: {}, "{}", {"actual": "json"}, '{"actual": "json"}', some text, "some text"
But no matter what, I get this in the error console
SyntaxError: JSON Parse error: Unexpected EOF
at <parse> (:0)
at parse (native)
at stringify (native)
at <anonymous> (/usr/local/server/src/function/src/main.ts:7:12)
at starDefault (/usr/local/server/src/function/src/main.ts:5:16)
at <anonymous> (/usr/local/server/src/server.ts:172:20)
at processTicksAndRejections (:12:39)
I'm using Bun1.1 as the runtime.
you need to return a response
Same thing
export default async ({ req, res, log, error }: any) => {
log(Date.now())
log(JSON.stringify(req, null, 2))
return res.empty()
}
If i just log(req) then I get
SyntaxError: JSON Parse error: Unexpected EOF
at <parse> (:0)
at parse (native)
at stringify (native)
at write (/usr/local/server/src/logger.ts:61:27)
at log (/usr/local/server/src/server.ts:145:14)
at <anonymous> (/usr/local/server/src/function/src/main.ts:7:3)
at starDefault (/usr/local/server/src/function/src/main.ts:5:16)
at <anonymous> (/usr/local/server/src/server.ts:172:20)
at processTicksAndRejections (:12:39)
Okay some more info: Deploying the same code with node22 works as expected. Trying to then switch this over to Bun gives me an error that npm is not installed
Sounds like the issue is with the Bun1.1 runtime, I'll try porting to node later to see if that fixes things, but the support for Bun is one of the main reasons I switched from supabase
Recommended threads
- Function failing with no real explainati...
```js import {Client, ID, Messaging} from 'node-appwrite'; export default async ({req, res, log, error}) => { if (req.method !== 'GET') return res...
- Method EQUAL not wrking in REST API Quer...
Request: ``` postman request 'https://nyc.cloud.appwrite.io/v1/tablesdb/{databaseId}/tables/{tableId}/rows?queries[]={%22method%22%3A%22select%22%2C%22values%2...
- OIDC not working on Appwrite cloud
tl;dr: same project settings, same OIDC credentials. Auth works on self hosted but not in cloud. I have a project in my self hosted instance with a single web ...