Git Product home page Git Product logo

Comments (14)

marcuspoehls avatar marcuspoehls commented on August 29, 2024

@sfabriece

Hi Fabriece, what’s your problem with both plugins active on a hapi server? Can you please provide more details?

Thank your for your kind words 😊

from hapi-dev-errors.

sfabriece avatar sfabriece commented on August 29, 2024

Both plugins do register fine. But when errors do happen, the swagger plugin takes over and I don't get the nice stacktrace that comes from using your plugin. This is why I suggested integration with hapi-swagger, so that you do the rendering of responses and errors. Because the rendering in hapi-swagger has room for improvement.

Is this enough?

from hapi-dev-errors.

marcuspoehls avatar marcuspoehls commented on August 29, 2024

Hi Fabriece,

I'm sorry, I couldn't reproduce your issue yet. Can you please help me with more details about your setup.

  • What Node.js version are you using?
  • What version of hapi-dev-errors are you using?
  • What's your hapi-dev-errors configuration you're passing to the plugin while registering it to the server?
  • What version of hapi-swagger are you using?
  • What's your hapi-swagger configuration you're passing to the plugin while registering it to the server?

Are you using the default theme for hapi-swagger? Are the API docs generated correctly when no error occurs?

Thanks!

from hapi-dev-errors.

sfabriece avatar sfabriece commented on August 29, 2024

Swagger config:

version : 9.1.1

await server.register([
      require('inert'),
      require('vision'),
      {
        plugin: require('hapi-swagger'),
        options: {
          schemes: ['http', 'https'],
          host: swagger.host,
          info: {
            'title': 'API Documentation',
            'description': 'API documentation ',
            'version': '0.0.1',
            'termsOfService': 'terms of Service link',
            'contact': {
              'email': ''
            }
          },
          jsonEditor: true,
          securityDefinitions: {
            'Bearer': {
              'type': 'apiKey',
              'name': 'Authorization',
              'in': 'header'
            }
          },
          security: [{
            'Bearer ': ['']
          }]
        }
      }
    ]);

hapi-dev-erros:

version 2.0.1

await server.register({
    plugin: require('hapi-dev-errors'),
    options: {
      showErrors: Config.util.getEnv('NODE_ENV') !== 'production',
      useYouch: true
    }
  });

Hapi version: 17.2.0

from hapi-dev-errors.

marcuspoehls avatar marcuspoehls commented on August 29, 2024

@sfabriece Thank you for the details. I'll try to reproduce the issue with your configs.

Do you register hapi-dev-errors after hapi-swagger?

from hapi-dev-errors.

sfabriece avatar sfabriece commented on August 29, 2024

yes I do

from hapi-dev-errors.

marcuspoehls avatar marcuspoehls commented on August 29, 2024

πŸ‘ alright, I'll let know you about my findings

from hapi-dev-errors.

sfabriece avatar sfabriece commented on August 29, 2024

Thanks πŸ˜„

from hapi-dev-errors.

marcuspoehls avatar marcuspoehls commented on August 29, 2024

@sfabriece Hey Fabriece,

did you solve your issue already?
I couldn’t reproduce it in my local setup. Can you give me a minimal project that has your issue? This way I could debug the problem there.

Thanks!

from hapi-dev-errors.

sfabriece avatar sfabriece commented on August 29, 2024

I'm currently a bit busy with a project. I'll get back to you when things cool down. Thanks for your help so far.

from hapi-dev-errors.

marcuspoehls avatar marcuspoehls commented on August 29, 2024

@sfabriece Sure, no problem. I had an idea to try another way of finding the issue. Will let you know about my testings.

from hapi-dev-errors.

marcuspoehls avatar marcuspoehls commented on August 29, 2024

I used your Swagger configuration and I see an error with the JSON payload from hapi-dev-errors when opening the Swagger docs in the browser. The issue on my side is that Swagger can't find the swagger.json file.

Seems like hapi-dev-errors intercepts the 500 response, returns JSON and Swagger ultimately renders this payload.

@sfabriece Is this your issue?

image

from hapi-dev-errors.

marcuspoehls avatar marcuspoehls commented on August 29, 2024

@sfabriece Did you had the chance to check on this issue?

from hapi-dev-errors.

marcuspoehls avatar marcuspoehls commented on August 29, 2024

@sfabriece I'm closing this issue due to inactivity. Please don't mind reopening it if you still run into this problem in the future. Let me know about your setup and findings then :)

Thanks!

from hapi-dev-errors.

Related Issues (5)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.