We need to handle missing requests in buildDeferredFunction

29 views
Skip to first unread message

ari gold

unread,
Apr 3, 2017, 5:58:34ā€ÆPM4/3/17
to Lift
Allo,

We ran across an issueĀ where S.req returns aĀ Req without a HTTPRequest inside. Ergo, when we call HttpRequest.snapshot in Req.snapshot, we get a NPE.Ā The basic question is what to do with Req when you're in a comet context.

To fix this, we modifiedĀ currentReq in both definitions of buildDeferredFunction so that they filter out null requests:

val currentReq = S.request.filter(_.request != null).map(_.snapshot)

What's the best way to handle this? Submit a PR?

Thanks y'all,

Ari

Antonio Salazar Cardozo

unread,
Apr 4, 2017, 8:58:18ā€ÆAM4/4/17
to Lift
Methinks a PR would be bomb, but first a Github issue!

To clarify here, the situation is basically:

Ā - Someone sends a message to a comet.
Ā - We try to create a deferred function (in this case, it's for the future-with-session
Ā  Ā helpers that Piotr created) for lazy-loading.
Ā - The deferred function builder tries to snapshot the current HTTPRequest.
Ā - That object is null (due to being in a comet context), and things go boom.

Correct?
Thanks,
Antonio

Matt Farmer

unread,
Jun 13, 2017, 10:14:31ā€ÆAM6/13/17
to Lift
Just to complete the thread here, this has been fixed and merged for 3.1.0-RC1.

And congratulations to Ari on his first contribution to Lift!

Antonio Salazar Cardozo

unread,
Jun 13, 2017, 1:46:29ā€ÆPM6/13/17
to Lift
Yay! šŸŽ‰

ari gold

unread,
Jun 13, 2017, 4:32:02ā€ÆPM6/13/17
to Lift
Grazie!

Sure y'all did between 95-99% of the thinking but damn I'll take it! :D

'gotta start somewhere šŸ’Ŗ!
Reply all
Reply to author
Forward
0 new messages