Where communities thrive

  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
Repo info
  • Jan 31 2019 16:43
    uniconstructor edited #4126
  • Jan 31 2019 16:41
    uniconstructor edited #4126
  • Jan 31 2019 16:41
    uniconstructor opened #4126
  • Jan 31 2019 03:44
    dzungh0ang closed #4123
  • Jan 30 2019 00:25
    techaks closed #4125
  • Jan 30 2019 00:02
    techaks edited #4125
  • Jan 30 2019 00:01
    techaks opened #4125
  • Jan 29 2019 23:33
    jkpulido opened #4124
  • Jan 29 2019 13:32
    nabdelgadir closed #4114
  • Jan 29 2019 09:17

    bajtos on add-node10


  • Jan 29 2019 07:13
    dzungh0ang opened #4123
  • Jan 29 2019 04:25
    dhmlau closed #3881
  • Jan 28 2019 13:14
    bajtos edited #4119
  • Jan 28 2019 12:47
    bajtos labeled #4121
  • Jan 28 2019 12:46
    bajtos labeled #4118
  • Jan 28 2019 12:46
    bajtos labeled #4118
  • Jan 28 2019 12:46
    bajtos labeled #4118
  • Jan 28 2019 12:46
    bajtos assigned #4118
  • Jan 25 2019 19:50
    dhmlau closed #3906
  • Jan 25 2019 19:13
    mschnee synchronize #4119
Screen Shot 2021-02-22 at 4.49.13 PM.png
hi everyone. I create a services base on strongloop. But i got the error when start services ( I connect mysql )
anyone can help me ?
Rifa Achrinza

GitHub Discussions Enabled :tada:

To help encourage and foster an open community, the GitHub Discussions tab has been enabled. Engage in Q&As, Idea Proposals, or showcase your extensions and projects using LB4.

GitHub Discussions will work alongside Slack to help increase community reach and interaction, and both are actively monitored by the LoopBack 4 Maintainers.

See you there!

GitHub Discussions: https://github.com/strongloop/loopback-next/discussions/7155

Slack: https://loopback.io navbar or strongloop/loopback-next#5048.

Eduardo Mazzucchelli

Hi people, Anybody knows what could be the problem with loopback 4.



Hey Guys, slowly I'm getting frustrated, maybe you can help me out. My problem might be more of a TypeScript problem than a lb4 problem, but maybe you ran into this too.

I built a controller to download a file, like described here: https://loopback.io/doc/en/lb4/File-upload-download.html

Thus I'm injecting the response into my function. Now I'm trying to write a unit test for the controller and am trying to create a stubInstance for the response object which is expected by the function with sinon, but Typescript is not capable of create a stub for an interface. (Type 'SinonStubbedInstance<Response>' is missing the following properties from type 'Response<any, Record<string, any>>': sendStatus, links, send, jsonp, and 77 more.)

Long story short: Any ideas how to unit-test a controller with a injected response object?

1 reply
Hello Guys, anyone can help me to generate gRPC server on loopback -4
or it will batter if you have exmpale of it then send me
Hi, We are working on a nodeJS/loopback application which has few REST APIs to do some CRUD operations. This application also needs to forward requests to external URLs identified at runtime based on a user requests and the data added by CRUD operations. The CRUD operations need authentication and authorization. Where as the requests to be forwarded do not need this support. One of the approach to implement this application I could think off is
i) Implement global interceptors for Authentication, authorization as global interceptors
ii) Controllers, services for CRUD operations on URI /data and apply authentication and authorization on this.
iii) Implement a local interceptor for a controller for particular URI say /forward to invoke middleware provided by node module http-proxy-middleware, to forward the requests to external URLs with headers and body.
Is this a good solution for this problem? What could be a better approach?
How to avoid authentication interceptors getting invoked for requests beling forwarded
Do we need to do any additional to avoid CORS issues as cors is the first middleware called in the sequence
Arun Kumar
@krsubbar The best approach would be to have the authentication an authorization has a middlewares and would be the first middlewares to hit for every request.
if the authentication, authorization middleware fails the conditions, then the subsequent middlewares aren't invoked.
app.use('/authentication', checkAuthentication)
app.use ('/authorization', checkAuthrorization)
app.use('/protectedResource', protectedResourceController)
Steven Altsman
Hi - I have a not-really-QQ about generating controllers/models from OpenAPI and an error where I can't pinpoint to troubleshoot:
Request GET /v1/characters failed with status code 500. Error: Invalid type for property Armor
    at Function.ModelClass.registerProperty (S:\dev\runes-law\player-api\node_modules\loopback-datasource-juggler\lib\model-builder.js:557:13)
    at ModelBuilder.defineClass [as define] (S:\dev\runes-law\player-api\node_modules\loopback-datasource-juggler\lib\model-builder.js:642:16)
    at SageMongoDataSource.defineClass (S:\dev\runes-law\player-api\node_modules\loopback-datasource-juggler\lib\datasource.js:837:40)
    at CharacterRepository.definePersistedModel (S:\dev\runes-law\player-api\node_modules\@loopback\repository\src\repositories\legacy-juggler-bridge.ts:205:35)
    at CharacterRepository.ensurePersistedModel (S:\dev\runes-law\player-api\node_modules\@loopback\repository\src\repositories\legacy-juggler-bridge.ts:165:17)
    at CharacterRepository.resolvePropertyType (S:\dev\runes-law\player-api\node_modules\@loopback\repository\src\repositories\legacy-juggler-bridge.ts:224:14)
    at S:\dev\runes-law\player-api\node_modules\@loopback\repository\src\repositories\legacy-juggler-bridge.ts:200:22
    at Array.forEach (<anonymous>)
    at CharacterRepository.definePersistedModel (S:\dev\runes-law\player-api\node_modules\@loopback\repository\src\repositories\legacy-juggler-bridge.ts:190:43)
    at CharacterRepository.ensurePersistedModel (S:\dev\runes-law\player-api\node_modules\@loopback\repository\src\repositories\legacy-juggler-bridge.ts:165:17)
    at new DefaultCrudRepository (S:\dev\runes-law\player-api\node_modules\@loopback\repository\src\repositories\legacy-juggler-bridge.ts:144:28)
    at new CharacterRepository (S:\dev\runes-law\player-api\src\repositories\character.repository.ts:14:5)
    at S:\dev\runes-law\player-api\node_modules\@loopback\context\src\resolver.ts:76:14
    at Object.transformValueOrPromise (S:\dev\runes-law\player-api\node_modules\@loopback\context\src\value-promise.ts:298:12)
    at Object.instantiateClass (S:\dev\runes-law\player-api\node_modules\@loopback\context\src\resolver.ts:69:35)
    at S:\dev\runes-law\player-api\node_modules\@loopback\context\src\binding.ts:883:21
The API passes validation. I have the objects as components+JSON schemas, though I'm fine with moving all of into an API spec document
Steven Altsman
Is this not a good channel to ask questions?
Rifa Achrinza

Hi @manchuwook, Slack is the recommended platform.

Here’s a copy of my previous message above:


Have a question about LoopBack? Please read this!

Hi everyone, gentle reminder that Slack is the recommended platform for the community and Gitter is not actively monitored by the maintainers. A link can be found on https://loopback.io navbar and strongloop/loopback-next#5048.

HI is there a way to manage opening and closing of database connections in loopback3
Dharmender Yadav

Hi, I have created a model and trying to cast/validate the post req body. But, loopback is ignoring the model definition.
Model Definition :

import {Entity, model, property} from '@loopback/repository';
import {company, customer} from '../interfaces';
export class BulkCompany extends Entity {
type: 'number',
id: true,
generated: true,
id?: number;

type: 'object',
required: true,
company: company;

type: 'object',
required: true,
customer: customer;

constructor(data?: Partial<BulkCompany>) {
export interface BulkCompanyRelations {
// describe navigational properties here
export type BulkCompanyWithRelations = BulkCompany & BulkCompanyRelations;

Interfaces :

export interface beneficialOwners {
name: string;
title: string;
ownershipPercentage: number;
export interface company {
name: string;
state: string;
type: string;
designator: string;
website: string;
description: string;
industry: string;
beneficialOwners: beneficialOwners[];
alternateName: string;

export interface customer {
email: string;
name: string;
phone: string;
addressLine1: string;
addressCity: string;
addressState: string;
addressZip: string;

Route :

async createBulkCompanies(
content: {
'application/json': {
schema: {
type: 'array',
additionalProperties: false,
items: getModelSchemaRef(BulkCompany, {
title: 'BulkCompany',
exclude: ['id'],
company: [Omit<BulkCompany, 'id'>],
): Promise<any> {}

Problem is i am not getting a validation on company.beneficialOwners

Mathews Mathai
Getting "Cannot read property 'apply' of undefined" on calling Module. get relatedModel() after overriding Model.findOne().
Posted the same on SO if anybody would like to help: https://stackoverflow.com/questions/68665417/overriding-built-in-crud-methods-cannot-read-property-apply-of-undefined
which is the best open source reporting tool for java application which has open source designer as well?
Hi Everyone ! I am digging the authentication/authorization implementation of JWT proposed by LB team. I think about generating a new TOKEN_SECRET to sign tokens at every server restart and delete all token at every start. I also think about creating a endpoint to manually regenerate the token secret with admin authorization that would also delete all tokens. What do you think about that ? Should I also create a auto regeneration of token secret ? (every 2 weeks for example)
I mean, is it the most secured way ?
I think I will go with generating a new TOKEN SECRET everytime, this way there is no possibility of leaking other than going through bindings server side, the secret won't be known from anybody not having access to code + ssh server, this will disconnect user everytime server is restarted, I don't think it's a problem if it ensures security. Everytime a user tries to connect and his token isn't anymore compatible with signature, it will ask for a reconnection with password.
jeez, I didn't see last user message date, I guess this chat is dead.
Rifa Achrinza

Hi @mightytyphoon, Slack is the recommended platform.
Here’s a copy of my previous message above:

Have a question about LoopBack? Please read this!

Hi everyone, gentle reminder that Slack is the recommended platform for the community and Gitter is not actively monitored by the maintainers. A link can be found on https://loopback.io navbar and strongloop/loopback-next#5048.

need help in implementing the multi strategy middle ware
Implemented the multi tenant strategy as a standalone application from the example, But when importing to another application it fails and the multi tenant middleware context is not called. I am not sure I understand the multitenantactionprovider as I dont see them in the code. Can you please help how to integrate this example in existing application?
Kelden Dradul Dorji

Hi. I am using loopback 3. I have a model location with relationship to

"resident": {
      "type": "belongsTo",
      "polymorphic": true

How do I write the same for relationship to resident in Loopback 4?

Hi, we get this error in middleware - Error: Cannot resolve path "params"
"loopback-kafka-consumer-middleware": {
"params": {
"consumerHandler": "./kafkaEventHandler"
the file is there under ./server
any help / advice would be highly appreciated.
Bunthon Dev
Hi everyone,
I am new with loopback, i have 2 models, user and asset model
Do loopback provide crud that can insert user and it's assets in one request?