Forums de discussion
Mismatched anonymous define() module: function
Kailash Yadav, modifié il y a 7 années.
Mismatched anonymous define() module: function
Regular Member Publications: 211 Date d'inscription: 18/10/11 Publications récentes
Hello,
I am using AWS javascript SDK in custom portlet. I copied sdk JS files in /META-INF/resources/js/ folder.
When I included these js files in view.jsp and on page render, I am getting following error in browser for axios.js :
When I make API call to AWS, I get following error in browser:
I found this thread and I did following steps as mentioned in thread.
But I am still getting same error (Uncaught ReferenceError: axios is not defined).
Here I am not using axios.js directally from my view.jsp. It called from AWS sdk files.
Can someone please help me to resolve this issue?
Thanks in Advance!!!
I am using AWS javascript SDK in custom portlet. I copied sdk JS files in /META-INF/resources/js/ folder.
When I included these js files in view.jsp and on page render, I am getting following error in browser for axios.js :
Mismatched anonymous define() module: function...
When I make API call to AWS, I get following error in browser:
Uncaught ReferenceError: axios is not defined
at Object.awsSigV4Client.makeRequest (sigV4Client.js:209)
at Object.apiGatewayClient.makeRequest (apiGatewayClient.js:50)
at Object.apigClient.getproductsGet (apigClient.js:478)
I found this thread and I did following steps as mentioned in thread.
- axios.js location is /META-INF/resources/js/lib/axios/dist/axios.js
- Created config.js in /js/ folder:
Loader.addModule({
dependencies: [],
anonymous: true,
name: 'axios',
path: '/o/productsearchweb/js/lib/axios/dist/axios.js'
}); - Removed axios.js(included earlier)) from view.jsp
- Added following lines in bnd.bnd file :
Liferay-JS-Config: /META-INF/resources/js/config.js
(also tried to include config.js in view.jsp - In view.jsp :
<aui:script use="aui-base"> AUI().ready( function() { require(['axios'], function(axios) { var apigClient = apigClientFactory.newClient({...}); var params = {}; var body = {}; var additionalParams = {}; apigClient.getproductsGet(params, body, additionalParams) .then(function(result){ console.log(result); }).catch( function(result){ console.log(result); }); }, function(error) { console.error(error); } ); }); </aui:script>
But I am still getting same error (Uncaught ReferenceError: axios is not defined).
Here I am not using axios.js directally from my view.jsp. It called from AWS sdk files.
Can someone please help me to resolve this issue?
Thanks in Advance!!!
Kailash Yadav, modifié il y a 7 années.
RE: Mismatched anonymous define() module: function
Regular Member Publications: 211 Date d'inscription: 18/10/11 Publications récentes
bump
Davide Trevi, modifié il y a 7 années.
RE: Mismatched anonymous define() module: function
New Member Publications: 6 Date d'inscription: 01/03/17 Publications récentes
Hi Kailash Yadav,
did you find any solution?
did you find any solution?