Your blazor server code is doing a JavaScript interop to call jQuery, but the jQuery library is not loaded. Check your use of jQuery.
Weird Exception in App Service
Hi All,
I am seeing a weird intermittent exception in my logs:
Microsoft.JSInterop.JSException: jQuery is not a function
TypeError: jQuery is not a function
at Module.NewDocumentElement (https://<id>.azurewebsites.net/_content/DragonSpark.Presentation//Environment/Browser/Document/DocumentElement.js:12:32)
at https://<id>.azurewebsites.net/_framework/blazor.server.js:1:3501
at new Promise (<anonymous>)
at kt.beginInvokeJSFromDotNet (https://<id>.azurewebsites.net/_framework/blazor.server.js:1:3475)
at https://<id>.azurewebsites.net/_framework/blazor.server.js:1:72001
at Array.forEach (<anonymous>)
at kt._invokeClientMethod (https://<id>.azurewebsites.net/_framework/blazor.server.js:1:71987)
at kt._processIncomingData (https://<id>.azurewebsites.net/_framework/blazor.server.js:1:70029)
at vt.connection.onreceive (https://<id>.azurewebsites.net/_framework/blazor.server.js:1:64432)
What's weird about this is the root URI where this exception is occurring, and I want to verify this. I have my .azurewebsites.net
seen above, but it also is forwarded to a custom domain. According to the exception message, it appears this is occurring in the azurewebsites.net location, but I cannot verify this. I am looking in the event log and it does not say which URL this occurs in.
When an exception occurs, is there some way of seeing what the requested URI/host was when this occurred?
To further round this out, what's weird about this is that if this indeed occurring in my .azurewebsites.net
address, that is entirely unexpected and a little worrisome, as I have never broadcasted this URI and I am wondering how someone might find this. The only address I have advertised is the custom domain, and I am worried if my .azurewebsites.net address is somehow being leaked somewhere with my configuration.
Thank you for any assistance you can provide,
Michael
7 answers
Sort by: Oldest
-
-
Bruce (SqlWork.com) 56,531 Reputation points
2022-05-01T19:00:20.83+00:00 Error indicates jQuery was not loaded. Maybe the hosting site not a available or blocked. or a scripting error is produced. Are you using an async load?
The reported url is the url of the blazor.server.js file you are hosting.
-
JasonPan - MSFT 4,366 Reputation points Microsoft Vendor
2022-05-03T01:57:04.343+00:00 Bruce's analysis is correct, the fundamental reason is that jquery is not loaded. I read your original post and I can assume that your webapp is working fine on pc's browser. It just doesn't load properly in the iPhone's safari browser.
Please let me know if my understanding is wrong. My suggestion is as follows:
- First make sure that we can access the webapp normally using the PC without encountering this error.
- Download the Chrome or Edge app on your iPhone, then go ahead and try accessing the webapp
If you follow the above steps and find that everything is normal, then you can conclude that the safari browser in the iOS system intercepts the jquery file under the
https://<id>.azurewebsites.net
site. Regarding the safari browser in iOS, we normally encounter the phenomenon that the video cannot be opened, so we have reason to doubt whether our site is not trusted, which causes the file to fail to be loaded.We can try to replace the jquery file in the project with the code below.
<script src="https://code.jquery.com/jquery-1.12.4.js"></script>
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.Best Regards,
Jason -
Mike-E-angelo 476 Reputation points
2022-05-04T15:48:19.753+00:00 I've updated my logging to include the root URI of the calling request, so that will solve some problems in the interim. However:
- It really feels the request URI should already be available somewhere, so I am duplicating existing functionality which hinders performance
- It is still unclear how requests are being made to my
https://<id>.azurewebsites.net
address rather than my configured custom domain
-
Mike-E-angelo 476 Reputation points
2022-06-27T07:58:34.957+00:00 This still occurs. Another error:
Microsoft.JSInterop.JSException: bootstrap is not defined ReferenceError: bootstrap is not defined at eval (eval at <anonymous> (https://<id>.azurewebsites.net/_framework/blazor.server.js:1:3501), <anonymous>:1:1) at eval (<anonymous>) at https://<id>.azurewebsites.net/_framework/blazor.server.js:1:3501 at new Promise (<anonymous>)