moleculerjs / moleculer-web

:earth_africa: Official API Gateway service for Moleculer framework
http://moleculer.services/docs/moleculer-web.html
MIT License
291 stars 119 forks source link

Multipart file upload example doesnt output any file parameters in console #255

Closed apgapg closed 2 years ago

apgapg commented 3 years ago

Prerequisites

Please answer the following questions for yourself before submitting an issue.

Current Behavior

The sample file upload example doesnt log file parameters in console. https://codesandbox.io/s/moleculer-api-file-upload-y9kf6?from-embed=&file=/services/assets.service.js

> Sandbox Container: Starting sandbox y9kf6...
> Sandbox Container: Sandbox y9kf6 started
INFO  - => POST /
INFO  -    Call custom function in '  POST /upload => v1.assets.upload' alias
params FileStream {
  _readableState:
   ReadableState {
     objectMode: false,
     highWaterMark: 16384,
     buffer: BufferList { head: null, tail: null, length: 0 },
     length: 0,
     pipes: null,
     pipesCount: 0,
     flowing: null,
     ended: false,
     endEmitted: false,
     reading: false,
     sync: true,
     needReadable: false,
     emittedReadable: false,
     readableListening: false,
     resumeScheduled: false,
     paused: true,
     emitClose: true,
     autoDestroy: false,
     destroyed: false,
     defaultEncoding: 'utf8',
     awaitDrain: 0,
     readingMore: false,
     decoder: null,
     encoding: null },
  readable: true,
  _events: [Object: null prototype] { end: [Function] },
  _eventsCount: 1,
  _maxListeners: undefined,
  truncated: false,
  _read: [Function] }
context.meta.$multipart {}
INFO  - => POST /
INFO  -    Call custom function in '  POST /upload => v1.assets.upload' alias
params FileStream {
  _readableState:
   ReadableState {
     objectMode: false,
     highWaterMark: 16384,
     buffer: BufferList { head: null, tail: null, length: 0 },
     length: 0,
     pipes: null,
     pipesCount: 0,
     flowing: null,
     ended: false,
     endEmitted: false,
     reading: false,
     sync: true,
     needReadable: false,
     emittedReadable: false,
     readableListening: false,
     resumeScheduled: false,
     paused: true,
     emitClose: true,
     autoDestroy: false,
     destroyed: false,
     defaultEncoding: 'utf8',
     awaitDrain: 0,
     readingMore: false,
     decoder: null,
     encoding: null },
  readable: true,
  _events: [Object: null prototype] { end: [Function] },
  _eventsCount: 1,
  _maxListeners: undefined,
  truncated: false,
  _read: [Function] }
context.meta.$multipart {}

Expected Behavior

The parameters should get logged as in molecular web example

{
"filePath": "/Users/ayushpgupta/StudioProjects/moleculer-web/examples/__uploads/FLO Logo (1kx1k).png",
"meta": {
"$multipart": {
"submit": "Upload one image"
},
"a": 5,
"fieldname": "myfile",
"filename": "FLO Logo (1kx1k).png",
"encoding": "7bit",
"mimetype": "image/png"
}
}

Steps to Reproduce

Please provide detailed steps for reproducing the issue.

  1. Run the sandbox example
  2. Try uploading file
  3. See console

Reproduce code snippet

https://codesandbox.io/s/moleculer-api-file-upload-y9kf6?from-embed

Context

Please provide any relevant information about your setup. This is important in case the issue is not reproducible except for under certain conditions.

Failure Logs

icebob commented 3 years ago

please try with 0.10.0-beta4: https://github.com/moleculerjs/moleculer-web/blob/master/CHANGELOG.md#multipart-fields--url-params