The Request Method is not allowed from the end-user apps. Could you try making the same API request in the server method and directly return the result from the response to the frontend app to show?
If $request is used in the server method, as @Sachin_Kumar mentioned, ensure the domain of the API endpoint is added to the whitelisted-domains
array in the manifest.json
file. You can refer to this sample app that makes an API from the end-user app.