Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • 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

    (compare)

  • 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
sondos alayyan
@sondoshassan

Hi
I am using loopback 4 for backend and react for front end.
when I make a request on API, it gives me blocked Cors.

I tried this :
let config = {
mode: 'cors',
cache: 'no-cache',
credentials: 'same-origin',
headers: {
'Access-Control-Allow-Origin': '*',
'Content-Type': 'application/json',
},
redirect: 'follow',
referrerPolicy: 'no-referrer',
}
const response = await axios.post(${API}/signUppatient, obj, config);
but it didn't work

Eduardo Mazzucchelli
@emazzu

hi, people, in some api rest, can I send and array and update more than entity ???
Example !!!

[
{"afeNumber": "3456-564",
"analysisPeriod": 36,
"d": 4164},
{"afeNumber": "3456-564",
"analysisPeriod": 36,
"id": 4164}
]

1 reply
Eduardo Mazzucchelli
@emazzu
is working this gitter ??? or the question I wound do for other way ???
Mesi Rendón
@mesirendon
Hi everyone. I have a quiestion. I'm using a datasource that I successfully could connect to my rest service.The thing is that I need to use a POST endpoint that expects a multipart/form-data. But I don't know how to pass the Buffer I have in memory to send to my endpoint
Here is the config for my datasource:
const config = {
  name: 'ipfs',
  connector: 'rest',
  baseURL: 'http://localhost:5001/api/v0/',
  crud: false,
  operations: [
    {
      template: {
        method: 'POST',
        url: 'http://localhost:5001/api/v0/add',
        headers: {
          'content-type': 'multipart/form-data;'
        },
        query: {
          'only-hash': true,
        },
        form: {
          file: '{file}',
        },
      },
      functions: {
        getCID: ['file'],
      },
    },
    {
      template: {
        method: 'POST',
        url: 'http://localhost:5001/api/v0/bootstrap/list',
      },
      functions: {
        getPeers: [],
      },
    },
  ],
};
Mesi Rendón
@mesirendon
Here's how I'm defining the interface:
export interface Ipfs {
  getCID(file: Buffer): Promise<CID>,
  getPeers(): Promise<unknown>
}
Mesi Rendón
@mesirendon
This was a nightmare, just to let you know guys.... I've ended installing axios and creating a local service. But I'm still wondering how to do it using the loopback-connector-rest module
Rifa Achrinza
@achrinza

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.
Tejash JL
@tejash-jl
Any suggestions on using Javascript for LoopBack4?
SUCI
@telefonosuci
Hi, i came from an lb3 application, there I have a view folders with some .pug templates. Can I migrate them also to my new lb4 app ? How can i define a route that renders a template instead of a json response ?
Henrik Holst
@hholst80
We migrated from lb2 to lb3 this summer and just realized that a long standing bug was caused by the upgrade. We have had a customer using the array of object functionality and apparently we need to enable allowArray in an option somewhere. However, I have not found where this option should be inserted. In the model json description I assume, but where?
Fabio Carpinato
@fbcarpinato
Hi guys, i've just created a new lb4 app and added a user model to it, by the time I try to run the migrate command nothing happens, I am using a MySQL db, what could be the issue?
Rifa Achrinza
@achrinza

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.
ktorrez
@ktorrez

Hello everyone, does anyone know how I can query REST API of a relation of many to many models:

model 1: users: {
iduser,
.......
}
model 2: conversation: {
idconversation,
......
}
model 3:
usersConversation: {
id
iduser,
idconversation
}

Dishant Rathi
@dishantr16
Request POST /files failed with status code 500. ResolutionError: The key 'services.FileUpload' is not bound to any value in context RequestContext-otWWxEc2SkiZZPwYchmTow-11 (context: RequestContext-otWWxEc2SkiZZPwYchmTow-11, binding: services.FileUpload, resolutionPath: controllers.ImagedetailController --> @ImagedetailController.constructor[0])
Hello Everyone, Can anyone here knows what this error means??
Rifa Achrinza
@achrinza

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.
REDSUNBOT
@phamios
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
@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
@emazzu

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

image.png

otmi
@otmi:matrix.org
[m]

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
meet401
@meet401
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
krsubbar
@krsubbar
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
@arunkumar413
@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)
A-E
@a-edw
hi
manchuwook
@manchuwook
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
manchuwook
@manchuwook
Is this not a good channel to ask questions?
Rifa Achrinza
@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.

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

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';
@model()
export class BulkCompany extends Entity {
@property({
type: 'number',
id: true,
generated: true,
})
id?: number;

@property({
type: 'object',
required: true,
})
company: company;

@property({
type: 'object',
required: true,
})
customer: customer;

constructor(data?: Partial<BulkCompany>) {
super(data);
}
}
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(
@requestBody({
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
@mathewsmathai1
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
springdev2022
@springdev2022
which is the best open source reporting tool for java application which has open source designer as well?
mightytyphoon
@mightytyphoon
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 ?
mightytyphoon
@mightytyphoon
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.
mightytyphoon
@mightytyphoon
jeez, I didn't see last user message date, I guess this chat is dead.
Rifa Achrinza
@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.

priyadharshini-gopal
@priyadharshini-gopal
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
@compressionmonkey

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?

koliapp2019
@koliapp2019
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.