Next.js failing to query another local server in getInitialProps - next.js

I'm trying to query a rails server running locally through getInitialProps, however I keep getting an error
Error: connect ECONNREFUSED 127.0.0.1:3000 at TCPConnectWrap.afterConnect
I know there's nothing wrong with the rails server as I can query it just fine through Postman and another non-next react application. Is there some extra config you need to pass to next.config.js to query another locally running server?

Related

Swagger API works normally locally but on IIS I get an internal server error after Execute my function

Swagger API works normally locally but on IIS I get an internal server error after Execute my function
Error image description:
**
Updated!!
The issue solved
It was from an invalid certificate
**

Infura and Brownie: HTTPError: 502 Server Error: Bad Gateway for url

I am getting this error every time I try to deploy my smart contract.
HTTPError: 502 Server Error: Bad Gateway for url
It seems Infura requires authentication for API calls as of today. How can I do this using brownie?
To add api_key to your brownie you need to add followings to your .env file created in the root of your project:
export WEB3_INFURA_PROJECT_ID=<your_api_key>
then go to your infura account and create a project then open Manage Key after that copy your key and add it to the line above. To make it available for brwonie to use run line below in terminal :
source .env
Check your code again and let me know if it worked

Browser client can't connect to DynamoDB in Docker container

I've been using #aws-sdk/client-dynamodb server-side (SvelteKit / NodeJS) connecting to localhost Docker container with instance of amazon/dynamodb-local:latest which works well. I used AWS CLI to configure tables, etc. I've created the client using the simplest configuration:
const client = new DynamoDBClient({ endpoint: 'http://localhost:8000' });
This works server-side, but when the same is executed client-side along with a command, I get a message that the region is missing. I've tried passing region: 'none', but then I get a message that the credentials are missing. Adding dummy credentials enables the command to execute, but I don't get an expected response. For example, sending the ListTablesCommand returns an empty array. If I do the same from the AWS CLI, I get the correct response.
Does the DynamoDB client run client-side, i.e., in the browser? Or am I missing something else?
No it doesn't run in a browser, You will need API Gateway and some backend code to connect a browser to Dynamodb.

WebSocket connection failed on Firebase hosted app

I want to use WebSockets to communicate between a web app and a game created in Unity.
I've created a simple chat app on both platforms and can communicate between them using an open WebSocket connection when I'm hosting the app locally.
Here's a short video of the app in action: https://gfycat.com/organicscholarlydeviltasmanian
However, when the app is hosted using Firebase Hosting, I get the error: WebSocket connection to 'wss://trainscape-app.web.app/' failed: Error during WebSocket handshake: Unexpected response code: 200
This is the line that throws the error, in a simple index.html function:
ws = new WebSocket(location.origin.replace(/^http/, 'ws'));
Does Firebase Hosting not support WebSockets in this way?
replace the line
ws = new WebSocket(location.origin.replace(/^http/, 'ws'));
with
ws = new WebSocket(location.origin.replace(/^http/, 'wss'));
build your web app and deploy again to firebase, it should work now.
Thanks

SignalR with Azure causes Bad gateway error 502

I have setup a site on Azure which is causing bad gateway error even though it's working perfectly fine on local machine. Here's the error I am facing:
Also failed request logs contains the following error:
SignalR logs are following:
SignalR Logs
I was adding the following line Startup.cs Configuration method:
GlobalHost.DependencyResolver.UseSqlServer(sqlConnectionString)
But SQL Azure doesn't support it and that's what was causing the issue.

Resources