Pymongodb Custom function unable to get results

hello, everyone. I am using custom function to do the map matching, but the return results are always {} . I do not what went wrong. Does anyone have any thoughts on this.
blew is my code.

collection.aggregate  [ {
'$addFields': {
'coordinates': {
'$function': {
'body': """
				function (locs){
				const exports = async function (locs){
				const radius = => 10);
				const profile = 'driving';
				const coordinates = locs.join(';');
				let accessToken = "pk.eyJ1IjoiZnVzb3lvzusYHInOxXA6MmliSA";
				const radiuses = radius.join(';');
				const query = await fetch(${profile}/${coordinates}?                             geometries=geojson&radiuses=${radiuses}&steps=true&access_token=${accessToken},
				{ method: 'GET' }
				const response = await query.json();
				// Handle errors
				if (response.code !== 'Ok') {
				${response.code} - ${response.message}
				return 0;
				const coords = response.matchings[0].geometry;
				return coords;
				return exports(locs);
    'args': ['$locs'],
    'lang': "js"

Javascript inside the MongoDB server is very, very restricted - basically you can only use it to compare values inside specific documents and even then it’s not a good idea. You cannot use it to make http connections or even interacts with other records in the database.
Also you may want to delete your API key in the example above.

Thank you very much, John. So I will do the matching outside mongo.