So I was trying to host a serverless function today.
First I tried Vercel, /api/index.js
And it was working fine in dev but as soon as I deployed it it started sending the code in response instead of executing the file and sending response as stated in it.
So now I'm trying Netlify but no luck here either.
/functions/tweet.js
the response
Related
I am trying to run Django project in local but not able to. Getting below error in local host
Bad Request (400)
I was not mentioning the actual URL. Its was localhost/accounts/login for this.
Its working as expected.
I have a react-native application that was working fine until last week when I started getting this error. Now when I make an https request, I get this error 'Network request failed' on both IOS and android. Whereas when I request using http it works fine.
TypeError: Network request failed
at fetch.umd.js:535:18
at JSTimers.js:250:18
at _callTimer (JSTimers.js:146:7)
at Object.callTimers (JSTimers.js:399:7)
at MessageQueue.__callFunction (MessageQueue.js:436:42)
at MessageQueue.js:111:12
at MessageQueue.__guard (MessageQueue.js:384:9)
at MessageQueue.callFunctionReturnFlushedQueue (MessageQueue.js:110:10)
at debuggerWorker.js:69:58
For testing purpose I have tried to make an https request from same react-native application to the dummy apis available on internet it works fine. Moreover, I have also installed the previous stable version of the application that was working fine before but getting the same error on this as well. So, from that I'm assuming that issue might be from the server end but I've not made any noticeable changes to the server that could make it behave like that.
The strange thing is that the server is not showing any request in the logs coming from the react native application but it works fine when I request it using the postman application.
I've tried every solution that was available on internet but nothing worked. Moreover, I've tried using fetch and axios both to send request but the issue persists.
I have also checked the ssl certificates are installed, valid and trusted. For server I'm using the rails puma along with Nginx server.
Below are the details of the version of my application.
React Native
react-native-cli: 2.0.1
react-native: 0.61.5
Nginx
nginx version: nginx/1.14.0 (Ubuntu)
Rails
Rails 5.2.2.1
ruby 2.6.8p205
puma 3.7
I am new to angular and developed an angular application using angular CLI 7.
When I am running the application from my local system, I am getting the response from the service and it is working fine.
But when I deployed the application in the production server, I am unable to get the response from the service. Service is taking too long to respond and getting the HTTPErrorResponse of status Unknown Error.
We are using the Spring microservices for api calls to get the response data.
I am using the proxy.conf.json for the services because the URL running angular app is different from the service.
proxy.conf.json:
{
"/api/*":{
"target":"http://wsd185erd986.test.com/api",
"secure":false,
"loglevel":debug,
"changeOrigin":true
}
}
Changed the package.json to include the proxy.conf.json in proxyConfig.
Include the response headers in the service.
Could any one know on how to configure these proxy settings in production build for angular. Do we need to include any headers in the service calls.
HTTPErrorResponse - A response that represents an error or failure,
either from a non-successful HTTP status, an error while executing the
request, or some other failure which occurred during the parsing of
the response.
So as per the docs this error is thrown in multiple cases either there is an error at server end and server send the error response or there was some issue in parsing.
Please check the Spring Boot API request logs to see what response code is sent back.
You can check the API by a standalone client too (like Postman) and see if there is some issue.
As an aside - you should not be using angular development server in production as it is meant for angular development. Typically you can use any web server ( like Apache, NGinx etc) to host your angular production files ( they are merely static resources) and then either use them as a proxy ( by having their proxy configuration) or have CORS enabled services.
I have been trying to implement the Node.js client for Umbraco headless. I have done the following:
Set up Umbraco headless via my Umbraco cloud subscription
Implemented a simple app in Vue.js
Copied the example code from https://our.umbraco.com/documentation/Umbraco-Cloud/Headless/Headless-Node-Client/
when I run this code (via my localhost:8000) I get an authentication error
https://{MyUmbracoCloudUrl}/umbraco/rest/oauth/token 400 (Bad Request).
My config has the correct domain name for the cloud instance and the correct user name an password.
I get a 400 response from https://{MyDOMAIN}/umbraco/rest/oauth/token.
Does anyone have any ideas? I am not sure if this is a cors issue becuase I am trying to run this from my local host?
Cheers
L
I have a Rails 4 application running on Heroku. For one type of request I make a HTTP call to an external service and then return the response to the client.
As I see from the logs, the request to the external service is taking too long and resulting in the Heroku's H12 error where it sends a 503 after 30 seconds. The HTTP request that I am making to the external service eventually comes back with a Net::ReadTimeout after some more time (60 seconds).
However if I run heroku run console and make the same HTTP call (through the same Ruby code), it works just fine. The request completes in about a second or two at the max.
I am unable to understand why this request is timing out when run from the web process while it works seamlessly in the heroku run console.
I am running Puma as my webserver. I followed guidelines given here : https://devcenter.heroku.com/articles/deploying-rails-applications-with-the-puma-web-server
I also tried the basic WEBrick server to see if that helps. But no avail.
Has anyone faced this issue? Any hints on how to debug this?