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

Null Pointer exception if configuration not correct #51

Closed
LasneF opened this issue Oct 6, 2023 · 2 comments
Closed

Null Pointer exception if configuration not correct #51

LasneF opened this issue Oct 6, 2023 · 2 comments
Labels
bug Something isn't working

Comments

@LasneF
Copy link

LasneF commented Oct 6, 2023

given a wrong config files

variables:
someVar: localhost:8000
redirectURL: http://localhost:8000
contract: ./component-descriptor.yml

paths:
/*:
target: ${http://localhost:8000}/ranch <= yes i know it is wrong 😅

call then crash with not clear details cf stack below

config miss configuration could be spot at loading time ; or if not possible just catch the null value

::1 - - [06/Oct/2023:11:03:53 +0200] "GET /ranch HTTP/1.1" 200 0 "" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/117.0.0.0 Safari/537.36 Edg/117.0.2045.47"
panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xc0000005 code=0x0 addr=0x8 pc=0x5d6b94]

goroutine 573 [running]:
net/url.(*URL).String(0x0)
/opt/hostedtoolcache/go/1.21.0/x64/src/net/url/url.go:810 +0x34
github.com/pb33f/wiretap/daemon.BuildHttpTransaction({0xc00008ec00?, 0xc00008ee00?, 0xc000806ff0?, 0xc000070ea0?}) /home/runner/work/wiretap/wiretap/daemon/build_request.go:140 +0x82f
github.com/pb33f/wiretap/daemon.(*WiretapService).validateRequest(0xc0005f7540, 0xc0009a00c0, 0xc000b82020?)
/home/runner/work/wiretap/wiretap/daemon/validate.go:74 +0x278
created by github.com/pb33f/wiretap/daemon.(*WiretapService).handleHttpRequest in goroutine 633
/home/runner/work/wiretap/wiretap/daemon/handle_request.go:157 +0xa65

@daveshanley
Copy link
Member

100% broken, will fix!

@daveshanley daveshanley added the bug Something isn't working label Oct 6, 2023
@daveshanley daveshanley mentioned this issue Nov 18, 2023
@daveshanley
Copy link
Member

Fixed in v0.0.40

Now renders out an explicit configuration error message instead of a panic.

Screenshot 2023-11-18 at 3 50 25 PM

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

No branches or pull requests

2 participants