serverless-devs / fc-http Goto Github PK
View Code? Open in Web Editor NEW在 阿里云 函数计算 中使用您现有的中间件框架(例如 Express、Koa)
在 阿里云 函数计算 中使用您现有的中间件框架(例如 Express、Koa)
when trying to return a binary file (20KB) to the caller. Caller side received corrupted binary file (35KB).
test-fc-http.zip
can be repro using attached modified sample project. under GET /file/:filepath endpoint.
to repro, try calling GET /file/data.jpg
the return image file becomes invalid.
no problem when returning text files.
have tried to set the binary flag as such, but none of the suggested options solve the above issue.
// option 1:
exports.handler = serverless(app);
// option 2:
exports.handler = serverless(app, {
binary: false // true / false doesn't matter, problem still exists
});
// option 3:
exports.handler = serverless(app, {
binary: ['image/*', 'application/octet-stream']
});
I would usually get the remote IP from value of req.headers['x-forwarded-for'] when my code is running in FC custom runtime.
but when using the Nodejs runtime via the fc-http wrapper, this value is undefined.
it would be good if it can be consistent with the usage of other runtimes like FC custom (I can also get it when running in AWS lambda through the serverless-http wrapper).
if not, what is your advice on how to get it (preferably an official method that will be persistent in future implementations).
Hi, was trying to upload binary file through multipart formdata to an Express endpoint that is wrapped by the fc-http.
for example, when a png file (27110 bytes) was uploaded, the service end received a file that has a size of 47553 bytes.
I have modify the Express example slightly to repro the issue, see attached zip.
test-fc-http.zip
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.