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

"exclude" option not considered while using app.setGlobalPrefix(..) in nestia.config.ts #746

Open
sourav-bhar opened this issue Jan 15, 2024 · 6 comments
Assignees
Labels
bug Something isn't working help wanted Extra attention is needed

Comments

@sourav-bhar
Copy link

sourav-bhar commented Jan 15, 2024

Summary

When calling the app.setGlobalPrefix(...) function in nestia.config.ts, it appears that the paths mentioned in the "exclude" option are also getting the global prefix (see example below). The correct behavior is that such paths should be excluded from the global prefix. When the SDK generates the fetch function for such routes, it should not apply the global prefix to their paths.

  • SDK Version: "@nestia/sdk": "^2.4.5",

  • Expected behavior: The sdk should not apply the global prefix to the paths included in the "exclude" option.

  • Actual behavior: The paths included in the "exclude" option should be ignored while setting the global prefix, but they are not being excluded in the generated sdk route.

Code where the bug is occuring:

import { INestiaConfig } from '@nestia/sdk';
import { VERSION_NEUTRAL, VersioningType } from '@nestjs/common';
import { NestFactory } from '@nestjs/core';
import { initializeApp } from 'firebase-admin/app';
import { AppModule } from './src/app/app.module';

const NESTIA_CONFIG: INestiaConfig = {
  input: async () => {
    initializeApp();

    const app = await NestFactory.create(AppModule, {
      bodyParser: false,
    });

    app.setGlobalPrefix('api', { exclude: ['/_ah/warmup'] });  // 👈 here 

    app.enableVersioning({
      type: VersioningType.URI,
      prefix: 'v',
      defaultVersion: VERSION_NEUTRAL,
    });

    return app;
  },
  output: 'libs/shared/client/api/src',
  clone: true,
  primitive: true,
};
export default NESTIA_CONFIG;
@samchon samchon self-assigned this Jan 15, 2024
@samchon samchon added the bug Something isn't working label Jan 15, 2024
@samchon
Copy link
Owner

samchon commented Jan 15, 2024

Can you provide a reproducible repo?

@sourav-bhar
Copy link
Author

OK, I will provide one tomorrow.

@Cryxto
Copy link

Cryxto commented Nov 8, 2024

hello i am encounter the same issue , for reproducible repo would you look to see mine @samchon ?

@samchon
Copy link
Owner

samchon commented Nov 15, 2024

@Cryxto Thanks for providing. I'll test it on this Sunday.

@samchon
Copy link
Owner

samchon commented Nov 15, 2024

@Cryxto Oops, there's no nestia.config.ts file in the repo.

@samchon samchon added the help wanted Extra attention is needed label Nov 15, 2024
@Cryxto
Copy link

Cryxto commented Nov 15, 2024

@samchon i am sorry not to describe clearly , i am following your docs for manual setup (fresh nestjs + nestia manual setup) and docs about nestia swagger generator. #CMIIW but it doesn't mention about nestia.config.ts.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

3 participants