-
-
Notifications
You must be signed in to change notification settings - Fork 94
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
jsonp call results in error: TypeError: this.uri_.cloneWithParams is not a function at goog.net.Jsonp.send #126
Comments
@realgenekim Thanks :) I somehow missed issue #124. Yes, I also think this could be due to shadow-cljs using a newer version of the Google Closure lib. You could try the solution proposed in #124 and if this is also working with stock ClojureScript we can add this to cljs-http. PR welcome! |
Roger that! I'll take a stab at it in the next couple of days — PS: Is it common to have Google Closure library API changes like this, where it breaks existing callers? |
@r0man Okay, I have a version of cljs-http.core/jsonp that works with the versions of Google Closure compiler that shadow-cljs uses... 🎉🎉🎉 I'll post a link to the diffs tomorrow. But it just hit me — seems like there should be a code path for the older versions of Google Closure goog.net, and one for the newer versions — how does one determine what version of the Closure compiler is being used? 🤔 Or to broaden the question, how do we tell which data structure to pass the Thank you! |
FWIW the "trusted" setup that parts of the closure-library use is purely for code-review purposes inside Google. They aren't actually enforced by the Compiler so you may "cheat" to get things to behave like you want. I haven't looked into this issue in particular but it appears that it is just calling a (set! js/goog.Uri.prototype.cloneWithParams
(fn [params]
(this-as goog-uri-instance
;; return whatever is needed?
))) |
@thheller What a clever idea. I'll have something in the next couple of days! |
Hi, @thheller and @r0man — not sure how to proceed on this one... I have had new JSONP call code working locally since Feb 2, but just recently found a React component that obviates need for this code entirely. Which means I can delete my local version of Here's the diff of what I have running — can you advise on what I can do to be most helpful, as JSONP definitely has a breaking change. Should I clean this up and put it into a pull request? (@thheller, I used a simpler method that I actually understood to create code that Google Closure would accept it.) Diffs are below — I'll put together a pull request, too. (May take me a bit: I've never modified code in a library before. 😱. Be back in an hour? 🤞)
|
@thheller Alas, I think this might be beyond my skills. (I'm even having trouble getting a REPL session open — I'm guessing I need to create a new lein project, with checkouts configured? In the meantime, I'm just trying to run the tests via
(I honestly have no idea how to caller determines which input type is needed, as dictated by which version of the library is running.)
Here's a link to my diffs. I'll take any advice or suggestions, but at this point, consider me stuck. Thank you! |
Sorry can't help much. The whole "Trusted" setup inside the closure library code is very useful but it is very invasive and sort of an all or nothing proposition. If you don't do it properly everywhere you might as well not do it at all. Just hacking arround it is definitely not the right approach. So I'd probably just write the 20 lines of code to get Jsonp working myself in CLJS without those checks and stop using This should now affect all newer CLJS releases since that is now using the same closure-library version as shadow-cljs. |
@r0man — thank you for this wonderful library. I've been using it for 2+ years. I recently switched an app from figwheel to shadow-cljs, and now
jsonp
fails. Maybe because it uses a newer version of the Google Closure library?I thought this might have had to do with the issue #124, which appears to be because of an interface change: " goog.net.Jsonp expect uri to be goog.html.TrustedResourceUrl (string of goog.Uri were valid before)".
Exact error from a browser REPL below — any advice would be much appreciated. Thanks in advance!!!
The text was updated successfully, but these errors were encountered: