Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Aug 07 13:10
    disce-omnes opened #1115
  • Aug 05 09:47
    HaiBien commented #1114
  • Aug 05 08:31
    intech commented #1114
  • Aug 05 07:25
    HaiBien commented #1114
  • Aug 05 07:10
    lucduong commented #1114
  • Aug 05 07:01
    HaiBien opened #1114
  • Aug 04 18:44
    Vslava commented #1105
  • Aug 04 12:31
    shawnmcknight commented #1113
  • Aug 04 10:56
    disce-omnes commented #1113
  • Aug 04 08:43

    icebob on master

    fixed the issue with setting tr… lint fixed metrics options with env variab… and 1 more (compare)

  • Aug 04 08:43
    icebob closed #1112
  • Aug 04 07:03
    AndreMaz commented #1105
  • Aug 04 06:49
    prasadmadanayake commented #1112
  • Aug 04 06:44
    prasadmadanayake edited #1112
  • Aug 04 06:40
    prasadmadanayake edited #1112
  • Aug 04 06:37
    prasadmadanayake synchronize #1112
  • Aug 03 22:54
    ccampanale commented #1113
  • Aug 03 19:49
    AndreMaz commented #1105
  • Aug 03 19:35
    intech commented #1113
  • Aug 03 19:34
    intech commented #1113
Zeeshan Haider
@zeeshanalisyed
I listed that issue on github as well
still no solution may be I am missing something
Mohammad Majid Khan
@majidk061
Hey
how to upload file using multer in moleculer
any one have idea i don't want to use busboy for file upload
Bruno Carneiro
@Tautorn

Hi there.
How do I change bodyparser json limit in moleculer-web?
Attempt:

@Service({
    name: "api",
    mixins: [
        ApiGateway,
   ],
   settings: {
        routes: [
            {
                authentication: true,
                whitelist: [
                    'api.ok',
                ],
                aliases: {
                    '/': 'api.ok',
                },
                bodyParsers: {
                    json: { limit: "5MB" },
                    urlencoded: { extended: true, limit: "5MB" }
                }
            }]
    }
})

But don't work =/

phuongpt0301
@phuongpt0301
Screen Shot 2020-08-30 at 09.45.29.png
I have problems about start services. Can you help me, please?
Satish Adabala
@apsnaidu

Hia,
Being a newbie to moleculerjs I'm trying to use passport with moleculerjs for authorization using Azure AD passport plugin. Thanks to the mixin https://github.com/icebob/kantab/blob/master/backend/mixins/passport.mixin.js by @icebob I'm able to apply the authorization at the alias level in API gateway service successfully. Now I'm trying to extend this functionality by using this mixin in a dedicated identity service that does the authentication and authorization based on the service name passed to it. I was thinking of using the authorize method of API gateway to forward the requests to identity service if theauthorization route setting is set to true. However, when I call the identity service using ctx.call method the passport mixin is not being invoked! Here is my authorize method.

    async authorize(ctx, route, req) {
      let verified;
        // Verify JWT token
        try {
          verified = await ctx.call("identify.verifyToken");
          if (verified) {
            this.logger.info("Authenticated via JWT: ", user.username);
            ctx.meta.user = _.pick(user, ["_id", "username", "email", "image"]);
            ctx.meta.token = token;
            ctx.meta.userID = user._id;
          }
        } catch (err) {
          console.log(err);
          throw new UnAuthorizedError(ApiGateway.Errors.ERR_INVALID_USER);
        }
      }

and here is the snippet of my identity service

const passportMixin = require("../mixins/passport.mixin");
module.exports = {
  name: "identity",
  mixins: [passportMixin({ successRedirect: "/api/v1/customer" })],
  settings: {
    routes: [],
    aliases: {},
  },
    actions: {
      verifyToken: {
        rest: "GET /verify",
        async handler(ctx) {
          try {
            console.log("Token is being verified");
          } catch (err) {
            console.log(err);
          }
        },
      },
    },
};

The passport mixin is defined to apply passport plugin at alias level like below and the callback is set to forward the request to a customer service

        route.aliases["GET /verify"] = (req, res) =>
          passport.authenticate("oauth-bearer", { session: false })(
            req,
            res,
            callback(req, res)
          );

I would've thought the identity service invokes the passport plugin before running the verifyToken method but the plugin doesn't get invoked and only the method is run printing the debug statement. My question is can I use passport mixin in other services than API gateway service and if so, what am I doing wrong here?

Thanks in advance!

Zeeshan Haider
@zeeshanalisyed
I want to build a File Upload Rest Api
What is the best practice
Zeeshan Haider
@zeeshanalisyed
How to disable JSON body parser for file uploads
for the specific route or service
thachnhanhbl
@thachnhanhbl
image.png
image.png
image.png
I cant publish image
help me
image.png
Hoàng Thành
@hoangthanh212
@thachnhanhbl : I dont think u need to put /public/ in url
just localhost:3000/filename.jpg
thachnhanhbl
@thachnhanhbl
thanks for support
Screen Shot 2020-12-21 at 12.34.58 AM.png
Screen Shot 2020-12-21 at 12.35.15 AM.png
help me how to config return oject, not array. thanks
i want to cofig image single
Hoàng Thành
@hoangthanh212

Screen Shot 2020-12-21 at 12.35.15 AM.png

Your question not clear... if u want fast response just go discord channel https://discord.com/channels/585148559155003392/585148559754657799

Nguyễn Phước Nguyên
@nphuocnguyen2000
s
thachnhanhbl
@thachnhanhbl
hello, I want to deploy 2 moleculer in a server. how to install the server? thanks
AhsanNissar
@AhsanNissar
const busBoy = new Busboy({ headers: "" });
busBoy.on("file",(fieldname, file, filename, encoding, mimetype) => {
console.log(filename,fieldname,mimetype,file,encoding);
});
I am gettin this error. 'Header are already sent'. What does this mean? I received an excel file and now I am trying to read its data but getting an error
what do i need to set in headers?
const busBoy = new Busboy({ headers: "" }); busBoy.on("file",(fieldname, file, filename, encoding, mimetype) => { console.log(filename,fieldname,mimetype,file,encoding); });
AhsanNissar
@AhsanNissar
{
"name": "MoleculerClientError",
"message": "File missing in the request",
"code": 400
}
Can anyone tell why this is saying file is missing. I am sending an excel file here
Nhanh Thach
@nhanhit1991:matrix.org
[m]
Hi all, I can't to populate with sequelize mssql ?
ThaDaVos
@ThaDaVos
Am I right that the page shown when accessing localhost:3000 is just a static page?
I thought it was dynamically generated based on your services but it seems it's not...
PerJer Official
@perjer4675:matrix.org
[m]
There is a custom a sample ?.
Caleb Adewole
@caleberi
@caleberi
@icebob please how do I resolve the nat-server issues after successfully building the docker image and push to heroku . But It seems nats-server can not be found/installed on heroku
or how can i make a live deployment of my microservice container?
Ryan DeGaris
@rdegaris

Why does APIGateWay convert number params to string? E.g

localhost:80/physicians?page=10

console.log (ctx.params)
{ page: '10' }

Any ideas? Is it the JSON serializer? Seems like a bug

Skit5
@Skit5

Hi guys, I'm slowly digging into this cool framework and I'm noticing something a bit off;

If you have 2 moleculer-web services (let's say the default api service and an extra http service running on a different port), the second one seems to cause a "service is not registered" issue on remote (rest) not local (repl call).

How would I get those 2 moleculer-web not conflicting so I could provide a differentiated local and remote access based on ports? Is it a config glitch or just not intended to run that way?
Thanks in advance for your feedbacks

Skit5
@Skit5
I'm really having a hell of a time with finding doc and making sense of what should be easy to figure out (like how to use the adapter to add a sorted list, how to serve specific static files or properly handling pagination with optional parameter as the pageSize cannot be -1 or >100), it slowly discourages me :(
Skit5
@Skit5
@rdegaris I had something similar. After adding the constraint:
page: "number|integer|positive"
I had to remove it because the passed parameter wasn't considered to be a number type :/
Thomas Greenhalgh
@tgreenhalgh

hey all,

When I go to the generic API endpoint, I get information about the system

"cpu": {
"load1": 0.25,
"load5": 0.27,
"load15": 0.16,
"cores": 2,
"utilization": 12
},
"mem": {
"free": 541687808,
"total": 4073267200,
"percent": 13.298607270350445
},
"os": {

etc, etc

Is there a way to turn that off?

randomnerd
@randomnerd
hey all,
anyone knows why adding a middleware breaks ctx.meta.$responseType?
with serviceguard middleware enabled, an action returns json, while without middleware it returns text/html as it supposed to
the middleware itself is simple and has nothing to do with ctx.meta.$responseType:
import { Errors } from 'moleculer'
import { AuthContext } from '../dto/auth.dto'

const ServiceGuard = {
    localAction(next, action) {
        return async function ServiceGuardMiddleware(ctx: AuthContext) {
            if (!action.restricted) return await next(ctx)
            const token = ctx.meta.$authToken
            if (!token)
                throw new Errors.MoleculerClientError(
                    'Service token is missing',
                    401,
                    'TOKEN_MISSING'
                )

            // TODO: cache the response because it won't change in runtime.
            await ctx.call('guard.check', { token, services: action.restricted })

            return await next(ctx)
        }.bind(this)
    },

    call(next) {
        return async function (actionName, params, opts: any = {}) {
            if (opts.parentCtx) {
                const { service } = opts.parentCtx
                const token = service.schema.authToken

                if (!opts.meta) opts.meta = opts.parentCtx.meta || {}
                opts.meta.$authToken = token
            }
            return await next(actionName, params, opts)
        }.bind(this)
    },
}
export default ServiceGuard
dhsimpson
@dhsimpson
Hi, can i get some examples without moleculer runner ?
sciento
@sciento
Hey, is it possible to use passport js with moleculer? I've tried it.. with settings.use and some routes, like in express, but i does not work. Any ideas?.