0

I have a Razor page that calls a script file to execute a script and that script makes a call to an API to validate email address. Recently I have made few changes to the script and added CSRF token to the call to API. We deployed the changes to the Dev server and it works fine but when we are promoting changes to UAT server, that script doesn't execute. When I use F12 dev tool to debug the issue I see the register.js file that contains the script is not loading with the page. Before making current changes, everything was working fine in all environments and script file was loading without any issue.

I have verified that the file does deploy properly on UAT server and does exist there. Folder structures are same on all servers and as I mentioned everything was working before making the current changes.

Register.js

` $.validator.addMethod("exists", function (value, element, params) {

 var valid = true; var token = $('input[name=__RequestVerificationToken]').val(); var headers = { "__RequestVerificationToken": token }; $.ajax({ url: '/api/SMC/SmcRegister/UserExists?email=' + value, type: "post", async: false, headers: { "__RequestVerificationToken": headers }, data: { __RequestVerificationToken: token}, success: function (exists) { valid = exists.toLowerCase() === 'false'; $(element).data('msg-exists', $(element).data('msg-exists').replace('{0}', value)); } }); return valid; }, $.validator.format("The email {0} already exists!"));` 

Page on UAT which is not loading Register.js

Page on UAT which is not loading Register.js

Same page on Dev server loading the page and script file fine

Same page on Dev server loading the page and script file fine

3
  • Have u tried refresh page in UAT from server? Like Ctrl-F5? If that been done try to load this page in incognito mode of your browser. Maybe something lingering in a cache and hold your js file back.CommentedSep 29, 2021 at 16:54
  • Yes, we tried refreshing pages, clearing cache etc and it doesn't work. Only difference between UAT and Dev is UAT environment has three servers and they are load balanced. So not sure if that is the reason but just wanted to throw it out there.CommentedSep 29, 2021 at 17:57
  • well, only thing is left: not all servers in UAT has that file. Did u check all servers in a balancing cluster? Because 404 has pretty straightforward explanation.CommentedSep 30, 2021 at 16:23

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.