Hey folks,
I’m hitting a wall with deploying my Node.js 18 app (using Express and TypeScript) to Appwrite. This is my first time with Appwrite and backend stuff, so I’m a bit stuck.
Here’s the Setup Stack: Node.js 18, Express, TypeScript Build Command:
yarn install --production=false && yarn build && node fix-extensions.js && yarn install --production --frozen-lockfile && node dist/server.js
First, install everything (yarn install --production=false).
Then build the app (yarn build).
Run a script to fix import extensions (node fix-extensions.js).
Reinstall just the production dependencies (yarn install --production --frozen-lockfile).
Finally, start the app (node dist/server.js).
so I am putting the entry point as dist/server.js as well in this case
The Problem When I deploy, I get these errors:
Initial Error:
{"message":"Runtime not ready. Container not found.","code":500,"version":"0.6.10"} This happens almost right away.
Timeout Error:(second error)
{"message":"Synchronous function execution timed out. Use asynchronous execution instead, or ensure the execution duration doesn't exceed 30 seconds."} After the first error, it seems like the deployment just times out(after 30 minutes of building ?) .
Everything works perfectly on my local setup, so it seems like it’s an Appwrite-specific issue? or i am not sure ? anyone has any ideas ?
if you run a demo/bare-bones function, does it work? Also, express might just not work on functions. Also, Cloud or Self Hosted?
thanks for helping ou, and yes this is gonna be Cloud hosted and yeah i just tried a bare-bones project with just node + typescript to see if it works, and it worked locally but in appwrite the same issue presented again.
this is my sever.ts
import { createServer } from 'http';
const server = createServer((req, res) => { res.statusCode = 200; res.setHeader('Content-Type', 'text/plain'); res.end('Hello from a barebones Node.js + TypeScript project!'); });
const PORT = process.env.PORT || 3000;
server.listen(PORT, () => {
console.log(Server running at http://localhost:${PORT}/
);
});
and this is my package.json
{ "name": "barebonesNode", "version": "1.0.0", "main": "dist/server.js", "license": "MIT", "scripts": { "build": "tsc", "start": "node src/server.js" }, "dependencies": { "@types/node": "^18.0.0", "typescript": "^5.6.2" } }
so, i dont think the issue is with express, since i am not using it in this bare-bones project - maybe it's typescript ?
the error was this as before on Appwrite
Synchronous function execution timed out. Use asynchronous execution instead, or ensure the execution duration doesn't exceed 30 seconds.
@darShan
i dnt think express would work on appwrite.
Recommended threads
- Get team fail in appwrite function
I try to get team of a user inside appwrite function, but i get this error: `AppwriteException: User (role: guests) missing scope (teams.read)` If i try on cl...
- Function in Node.JS to monitor events ar...
Hello everyone. I'm creating my first Node.JS function, but I don't have much experience with node and javascript. I'm trying to create a function, that monito...
- Deploy function not working - 503
Hellon i get this error message, when i try to deploy a new version of a function <html><body><h1>503 Service Unavailable</h1>No server is available to handle...