Replies: 9 comments 55 replies
|
No, we have no plan doing that. You are doing it wrong if you want to run a long-running process in Lambda, what you need is PaaS, not FaaS. |
|
Yeah really not something that belongs here. We don't have bandwidth to research into the new space. |
|
@tzsk something you can look for and use is to use only AdonisJS http server |
|
I try reopen this discussion, yeah its not best practice to have application in lambda, BUT, its possible and devs using this options daily. Great solution for MVP for example, you want check if product is valuable and not working on microservices and complex architecture from start. So why not API for SPA based on AdonisJs in Lambda.. You can check Laravel Vapor https://vapor.laravel.com, where people using Lambda for PHP with whole monolithic apps on serverless without issues. Its easy solution when people can deploy to serverless in few minutes. |
|
I solved it this way:
const { Ignitor } = require('@adonisjs/ignitor')
const createRequestResponse = require('aws-lambda-create-request-response')
const http = require('http')
var app;
function handler(event, context, callback) {
context.callbackWaitsForEmptyEventLoop =
process.env.WAIT_FOR_EMPTY_EVENT_LOOP === 'yes'
const { req, res } = createRequestResponse(event, callback)
app(req, res)
}
function bootstrapServer() {
return new Ignitor(require('@adonisjs/fold'))
.appRoot(__dirname)
.fireHttpServer((handler) => {
app = handler;
return http.createServer(handler);
})
.catch(console.error);
}
exports.proxy = (event, context, callback) => {
if (app == undefined) {
bootstrapServer().then(() => handler(event, context, callback))
return;
};
handler(event, context, callback);
}
service: service-users
provider:
name: aws
runtime: nodejs12.x
stage: qualidade
region: sa-east-1
functions:
index:
handler: aws-lambda.proxy
events:
- http:
cors: true
path: '/'
method: any
- http:
cors: true
path: '{proxy+}'
method: any
|
|
For anyone looking at this. https://github.com/tomhatzer/adonis-serverless
|
|
The NODE runtime is tightly coupled with the framework, If we'd want to use it we will have to maintain a forked version of the framework. surveyzop |
|
I've had success for years running node, express and Feathers.js apps on a single Google Firebase/Cloud Function. They also run on node on my local machine. https://github.com/buzzware/function-split-test
|
|
Spent some time trying to get this to work and I believe I have a solution at least for Adonis Commands running in a docker image on AWS Lambda, I don't think this would be a good idea for serving HTTP requests, more for running one off functions. I plan on using it with SQS triggering Lambda functions to have it process queued jobs. I made a small repo that has some instructions and files to make it easier for others to give it a try. Hopefully it helps some other people out. |
Uh oh!
There was an error while loading. Please reload this page.
The serverless request context is different than normal node server request, because there's no node server in Serverless.
Which is why, if we could do a Serverless adapter for adonis ts that'll be a treat.
Do you have any plans for this in the future? Or recently.
Would be sick if I could run Afonis on a Lambda 🔥😍
All reactions