Open Embraceeeee opened 2 years ago
@achrinza Thank you for your reply.
I could be wrong, but I think the issue is different from #8368 , because repository function will throw exception when i add {asProxyWithInterceptors: true}
.
export class TodoController {
constructor(
@inject('repositorys.TodoRepository', {asProxyWithInterceptors: true})
public todoFailRepository: TodoRepository,
@inject('repositorys.TodoRepository')
public todoSucessRepository: TodoRepository,
) { }
// http status code:500 fail!!!
@get('/todos-fail')
async findFail(
@param.filter(Todo) filter?: Filter<Todo>,
): Promise<Todo[]> {
return this.todoFailRepository.find(filter);
}
// http status code:200 sucess!!!
@get('/todos-sucess')
async findSucess(
@param.filter(Todo) filter?: Filter<Todo>,
): Promise<Todo[]> {
return this.todoSucessRepository.find(filter);
}
}
For more detail code, i've appended reproduction: https://github.com/Embraceeeee/loopback4-repository-proxy-issue
Hi @Embraceeeee, thanks for the reply and the the reproduction sandbox. I'll take a look at it. Ideally, both issues should be solvable through a single fix.
@Embraceeeee Can you try the following?
@get('/todos-fail')
async findFail(
@param.filter(Todo) filter?: Filter<Todo>,
): Promise<Todo[]> {
return this.todoFailRepository.find(filter, undefined);
}
HI, @raymondfeng thanks for your reply. I tried it and found the program run correctly. Do I have to add this undefined
parameter?
Describe the bug
What is the problem
When I use the global interceptor:
@inject('repositorys.xxxRepository', {asProxyWithInterceptors: true})
will be successfully intercepted. But many functions of repository variable not work!HTTP Status Code 500 Error:
Expected behavior
The interceptor takes effect and the repository variable function work.
Actual behavior
It throws the above exception.
How to reproduce the problem
Logs
No response
Additional information
No response
Reproduction
https://github.com/Embraceeeee/loopback4-repository-proxy-issue