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.

Gateway: output is generated in wrong directory

See original GitHub issue

Is there an existing issue for this?

  • I have searched the existing issues

Current behavior

Motivation

My goal is to generate a gateway for specific entity / feature, e.g. users. All features lie within a features directory. So when generating NestJS elements for these features, I usually call something like this:

nest g controller features/users

or

nest g service features/users

For most cases this will generate the files in the features/users directory,

so the path of the controller would be features/users/users.controller.ts and the path of the service features/users/users.service.ts

Both will be correctly registered in the existing UsersModule (features/users/users.module.ts)

Issue

For gateways however, this command

nest g gateway features/users

will place the gateway at features/users.gateway.ts and register it in the AppModule instead.

Workaround

To generate the gateway in the correct directory, you’d have to run

nest g gateway features/users/users

This different behavior from all other schematics makes it hard predict the outcome when using the cli and reduces the trust in how the CLI will modify the project. This can be irritating for new NestJS developers and such a special case is hard to remember, even for experienced devs.

Console Output

Here’s the console output from running the different schematics Bildschirmfoto 2022-02-23 um 17 14 08

Minimum reproduction code

https://github.com/homj/nestjs-gateway-schematic-directory-bug

Steps to reproduce

  1. create a new nest application
  2. create the users module: nest g module features/users
  3. create the users module: nest g controller features/users
  4. create the users module: nest g service features/users
  5. create the users gateway nest g gateway features/users
  6. the gateway will be placed in the wrong directory and registered in the AppModule instead of the UsersModule:

Expected behavior

The gateway schematic should behave like all other schematics and output the gateway at the specified path.

Package version

8.0.7

NestJS version

8.3.1

Node.js version

14.15.3

In which operating systems have you tested?

  • macOS
  • Windows
  • Linux

Other

No response

Issue Analytics

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

github_iconTop GitHub Comments

2reactions
kamilmysliwieccommented, Feb 24, 2022

This is intentional. We should allow setting it to false though (explicitly through flag or config)

1reaction
stanimirovvcommented, Mar 8, 2022

@micalevisk I’ve made a PR in the nest-cli repo: https://github.com/nestjs/nest-cli/pull/1561 Feedback is appreciated 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

Solved: Create folder bad gateway - Power Platform Community
I have a fairly simple flow. Sharepoint item created; get item; Create new folder; Grant access to folder; Send email.
Read more >
Gateway Script can't open directory - Ignition
It is under Control Panel > Administrative Tools > Services. Right click on the Ignition service and select Properties. Click on the Log...
Read more >
Troubleshooting: File Gateway issues - AWS Documentation
Your gateway reacts slowly when browsing directories · Your gateway isn't responding · Your gateway is slow transferring data to Amazon S3 ·...
Read more >
Files are sending to wrong sftp location while using Spring ...
We are using Spring SFTP (outbound) using Gateway to transfer files to multiple destinations. But often, few files are sent to the wrong...
Read more >
Can you change the intermediate file location in Rhapsody ...
Can you change the folder where the intermediate file is beeing generated in IBM Rational Rhapsody Gateway?
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