Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Does node-http-proxy works in Lambda ? #1352

Open
vipulkaneriya opened this issue Aug 6, 2019 · 5 comments
Open

Does node-http-proxy works in Lambda ? #1352

vipulkaneriya opened this issue Aug 6, 2019 · 5 comments

Comments

@vipulkaneriya
Copy link

I am trying to use node-http-proxy in my lambda function but it is giving error of Lambda Task timed out (no matter how long i keep Lambda timeout). How can I use this http-proxy in Lambda ?

here is my code:

app.js:

"use strict";
const express = require("express");
const app = express();
const httpProxy = require("http-proxy");
const proxy = httpProxy.createProxyServer({});

app.use('/', (req, res) => proxy.web(req, res, { target: 'www.google.com' }));

module.exports = app;

lambda.js

'use strict'
const awsServerlessExpress = require('aws-serverless-express')
const app = require('./app')
const binaryMimeTypes = [
'application/octet-stream',
'font/eot',
'font/opentype',
'font/otf',
'image/jpeg',
'image/png',
'image/svg+xml'
]
const server = awsServerlessExpress.createServer(app, null, binaryMimeTypes);
exports.handler = (event, context) => awsServerlessExpress.proxy(server, event, context)

@openainext
Copy link

?

@openainext
Copy link

Is there a solution

@vipulkaneriya
Copy link
Author

no

@openainext
Copy link

apiProxy.on('proxyReq', function (proxyReq, req, res, options) {
proxyReq.write(JSON.stringify(req.body));
})

@openainext
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants