Skip to content
This repository was archived by the owner on May 6, 2026. It is now read-only.
This repository was archived by the owner on May 6, 2026. It is now read-only.

Hapi: correctly extract url from request object #196

Description

@AdriVanHoudt

If you are still having issues, please be sure to include as much information as
possible:

Environment details

  • OS: Mac/Linux
  • Node.js version: 8.11.4
  • npm version: 6.4.0
  • @google-cloud/error-reporting version: 0.5.1
  • hapi version: 16.x (<- probably the most important one :D)

Steps to reproduce

  1. Throw in request handler
  2. Error logged in cloud console is missing an url
    * image

This is due to

.setUrl(req!.url as {} as string)

req.url can be an URL object. I would suggest to fallback to req.path or req.url.path.
If that sounds ok I can do a PR if you'd like

Following these steps will guarantee the quickest resolution possible.

Thanks!

Activity

  1. DominicKramer commented on Aug 27, 2018

    @DominicKramer
    Contributor

    Thank you for opening this issue. On initial investigation, I agree that using req.url.pathname should be used if req.url is a URL object. Feel free to open a PR if you want to, but don't feel like you need to. We can take care of this too. Thanks.

  2. added
    priority: p2Moderately-important priority. Fix may not be included in next release.
    type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.
    and removed
    🚨This issue needs some love.
    triage meI really want to be triaged.
    on Aug 27, 2018
  3. AdriVanHoudt commented on Aug 28, 2018

    @AdriVanHoudt
    Author

    I don't know typescript that well so not sure what as {} as string is doing so not sure what the quick fallback fix for this would be, thanks for picking this up!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

🚨This issue needs some love.api: clouderrorreportingIssues related to the googleapis/nodejs-error-reporting API.priority: p2Moderately-important priority. Fix may not be included in next release.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions