Replies: 8 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. |
Beta Was this translation helpful? Give feedback.
-
Yeah really not something that belongs here. We don't have bandwidth to research into the new space. |
Beta Was this translation helpful? Give feedback.
-
@tzsk something you can look for and use is to use only AdonisJS http server |
Beta Was this translation helpful? Give feedback.
-
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. |
Beta Was this translation helpful? Give feedback.
-
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
|
Beta Was this translation helpful? Give feedback.
-
For anyone looking at this. https://github.com/tomhatzer/adonis-serverless
|
Beta Was this translation helpful? Give feedback.
-
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 |
Beta Was this translation helpful? Give feedback.
-
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
|
Beta Was this translation helpful? Give feedback.
-
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 🔥😍
Beta Was this translation helpful? Give feedback.
All reactions