Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

使用代码染色功能的时候,遇到无法json序列化的返回值怎么办 #3097

Open
dayueba opened this issue Jul 21, 2023 · 1 comment
Labels
status: Holding Same features may be hold, and implements layer.

Comments

@dayueba
Copy link

dayueba commented Jul 21, 2023

目前有个函数返回的是 typeorm.EntityManager

  manager(): EntityManager {
    if (this.ctx.entityManager) {
      return this.ctx.entityManager;
    }
    const dataSource = this.dataSourceManager.getDataSource('default');
    return dataSource.manager;
  }

https://github.com/midwayjs/midway/blob/main/packages/code-dye/src/middleware.ts#L52

此时的 reqInfo 是无法json序列化的

image

@dayueba dayueba changed the title 使用代码染色功能的时候,遇到无语json序列化的返回值怎么办 使用代码染色功能的时候,遇到无法json序列化的返回值怎么办 Jul 21, 2023
@czy88840616
Copy link
Member

看起来是循环依赖导致的无法序列化,这个的确不好处理。

@czy88840616 czy88840616 added the status: Holding Same features may be hold, and implements layer. label Jul 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: Holding Same features may be hold, and implements layer.
Development

No branches or pull requests

2 participants