Skip to content

Question: How to use inside Google Cloud Run? #1029

Open

Description

@boustanihani

Question: How to use inside Google Cloud Run?

Is it possible to use Buffer.from(req.rawBody, "base64") instead of req inside Google Cloud Run =>

const form = new Formidable({
  uploadDir: os.tmpdir(),
  keepExtensions: true,
});
const [fields, files] = await form.parse(Buffer.from(req.rawBody, "base64"));

Activity

  1. tunnckoCore commented on Jul 22, 2025

    @tunnckoCore
    Member

    @boustanihani heya

    you should be able to pass request-like object that has a binary req.body and req.headers (nodejs like headers, i think object)

    that would be a lot easier and supported with v4. You can try formidable@next with parseMultipart(body, { boundary: 'boundary here' }) or parseMultipartRequest as seen here #1011 (comment)

  2. boustanihani commented on Jul 22, 2025

    @boustanihani
    Author

    Thanks, I will wait until v4 gets released and test this.

  3. PaulvanMotman commented on Aug 18, 2025

    @PaulvanMotman

    @boustanihani I had a need for this as well (I had to preserve the rawBody for some security check). It seems like it's working well with v3 already, as @tunnckoCore mentioned, when you re-construct the request. This worked for me:

      const rawBody = req.body as Buffer;
      return new Promise((resolve, reject) => {
        const form = formidable({
          keepExtensions: true,
        });
    
        const stream = new Readable();
        stream.push(rawBody);
        stream.push(null);
        (stream as IncomingMessage).headers = {
          ...req.headers,
          'content-length': rawBody.length.toString(),
        };
    
        form.parse(stream as IncomingMessage, (err, fields, files) => {
         // parsing fields/files here
       }
    
  4. boustanihani commented on Dec 22, 2025

    @boustanihani
    Author

    When will v4 be ready :) ?

  5. tunnckoCore commented on Dec 22, 2025

    @tunnckoCore
    Member

    @boustanihani sorry, a bit packed with other stuff, probably after new year. But it's in preview in the next dist-tag, nothing much to be changed in there apart from some security measures against a big security vulnerability I was reported that all prior versions has - and have a patch ready for v2 & v3 versions.

  6. boustanihani commented on Dec 22, 2025

    @boustanihani
    Author

    Thanks, I am currently using the workaround @PaulvanMotman suggested, it works :)

  7. boustanihani commented on Apr 16, 2026

    @boustanihani
    Author

    @tunnckoCore do we have an official example for usage inside Google Cloud Run somewhere?

    I checked https://github.com/node-formidable/formidable/tree/master/examples and also the docs but couldn't find anything relevant,

  8. tunnckoCore commented on Apr 19, 2026

    @tunnckoCore
    Member

    @boustanihani oh, sorry. Well, we don't have. But it's something close to #594 (eg. formidable-serverless), i believe, no?

  9. added
    Status: AcceptedIt's clear what the subject of the issue is about, and what the resolution should be.
    Type: DocumentationAn Issue or Pull Request for improving or updating documentation.
    Type: EnhancementMost issues will probably be for additions or changes. Expected that this will result in a PR.
    Type: QuestionA query or seeking clarification. Probably doesn't need the attention of everyone.
    on Apr 19, 2026
  10. boustanihani commented on Apr 28, 2026

    @boustanihani
    Author

    @boustanihani oh, sorry. Well, we don't have. But it's something close to #594 (eg. formidable-serverless), i believe, no?

    Yes, it's the same subject, but this one is specifically for Cloud Run :)

  11. tunnckoCore commented on May 15, 2026

    @tunnckoCore
    Member

    @boustanihani oh! gosh, i always mis-read that ;d

    well, the new api would be more minimal and standards compliant so it won't have such problems to begin with.

    (i'm referring v4)

  12. boustanihani commented on May 15, 2026

    @boustanihani
    Author

    When do you expect v4 to be officially released?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Status: AcceptedIt's clear what the subject of the issue is about, and what the resolution should be.Type: DocumentationAn Issue or Pull Request for improving or updating documentation.Type: EnhancementMost issues will probably be for additions or changes. Expected that this will result in a PR.Type: QuestionA query or seeking clarification. Probably doesn't need the attention of everyone.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions