Running Angular SSR on Deno Deploy
I have an Angular application with SSR, and when I run it locally with Deno, it runs without any problem, but I don't know how to host my application in Deno Deploy.
To run Angular with SSR with Deno, I would have to do
deno task serve:ssr:<name>
How could I run that in Deno Deploy using Github Actions?
6 Replies
I wasn't able to find the answer to your question in the official Deno documentation. However, based on your message, I can provide some general advice.
To deploy an Angular SSR application on Deno Deploy, you would typically need to create a
deploy.ts
script that starts your server and listens for requests. Deno Deploy expects an entry point file that exports a fetch
event handler. This handler is what Deno Deploy invokes when your application receives HTTP requests.
Regarding the specific command you mentioned (deno task serve:ssr:<name>
), Deno Deploy does not support Deno CLI tasks directly. Instead, you would need to adapt your Angular SSR setup to work with Deno Deploy's expected entry point format.
For integrating with GitHub Actions, you would set up a workflow that triggers on push to your repository, builds your Angular SSR application if necessary, and then deploys it to Deno Deploy using the appropriate API endpoint or CLI command.
Please note that this advice is not based on the Deno documentation, and I would advise you to double-check the accuracy of the advice given. You may also want to explore the Deno Deploy documentation and community resources for more specific guidance on deploying Angular SSR applications.What does the task do?
run the following command:
node dist/<name>/server/server.mjs
and if I try to run it directly with Deno I get the following error:
deno run -A dist/<name>/server/server.mjs
error: Relative import path "fs/promises" not prefixed with / or ./ or ../
If you want to use a built-in Node module, add a "node:" prefix (ex. "node:fs/promises").
Then why do u mean by “when I run it locally with deno”
U are using node…
If you do
deno task serve:ssr:<name>
you are using Deno, but in node compatibility mode, and it works perfectly
If inside the task u are using node to run the file then is not deno right?