question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[BUG] `mount` is ignored when used in modules

See original GitHub issue

Information

  • Version: >=5.5x
  • Packages: di

I use modules to avoid duplicating common components. It works well when we speak about middleware, filters, and pipes. However, controllers are just ignored. See example below:

@Controller('/')
export class HealthController {
  @Get()
  @Get('/health')
  @Returns(204)
  public health(): void {
    // noop
  }
}

@Module({
  mount: {
    '/api/v1/': [HealthController]
  }
})
export class HealthModule {
  // ...
}

@Configuration({
  // ...
  mount: {
    '/api/v1/': [ /* other controllers */ ]
  },
  imports: [HealthModule]
})
export class Service {

}

I have tried to add controllers on the $beforeInit hook, it also has no effect.

@Module({
  deps: [Configuration]
})
export class HealthModule {
 constructor(private readonly configuration: Configuration) {}
 
  public $beforeInit(): void {
    const endpoint = '/api/v1/';

    this.configuration.mount[endpoint] = (
      this.configuration.mount[endpoint] ?? []
    ).concat(HealthController);
  }
}

It seems it somehow connected with importProviders. That method resolves all providers concurrently, while imports must be initialized before building the module itself according to docs.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
Romakitacommented, Aug 29, 2021

For me it’s works with the latest version (6.x): https://github.com/tsedio/tsed-example-modules

0reactions
derevnjukcommented, Sep 2, 2021

Thanks) Everything works on v6

Read more comments on GitHub >

github_iconTop Results From Across the Web

[BUG] `mount` is ignored when used in modules - Tsedio/Tsed
I use modules to avoid duplicating common components. It works well when we speak about middleware, filters, and pipes. However, controllers are just ......
Read more >
Mount Fails in Ubuntu 14.04 · Issue #4693 - GitHub
I got the same issue, running the mount on a CentOS machine. Digging trought the module code, I found the issue to be...
Read more >
573548 – mount: no option to ignore fstab - Red Hat Bugzilla
Possible solutions: 1) Add a new mount internal option -N (or "-o nofstab") to "Mount without reading in /etc/fstab". This effectively ignores all...
Read more >
Bug #1448678 “ntfs3g -s option should be ignored, making autofs ...
I've troubled some with mounting ntfs-3g file systems with autofs. ... options gid=100,dmask=002,fmask=113,utf8,flush,rw,noatime,user using module generic
Read more >
Common bugs and issues — Anaconda 38.13 documentation
Anaconda fails with the dasbus.error.DBusError exception. This usually happens when a DBus module raises an unexpected exception. Anaconda shows a traceback ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found