pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Adrian Klaver <adrian.klaver@aklaver.com>
To: Marco Ippolito <ippolito.marco@gmail.com>
To: pgsql-general@postgresql.org
Subject: Re: Unable to connect to the database: TypeError: net.Socket is not a constructor
Date: Mon, 20 Apr 2020 11:11:14 -0700
Message-ID: <e6692a5d-46ee-5703-d4fb-11437870e89c@aklaver.com> (raw)
In-Reply-To: <CAFegzBQVR723sRfSR_x9=iVuuTV+dtEK5C=kNuhyJCoZxdaZUg@mail.gmail.com>
References: <CAFegzBQVR723sRfSR_x9=iVuuTV+dtEK5C=kNuhyJCoZxdaZUg@mail.gmail.com>

On 4/20/20 10:50 AM, Marco Ippolito wrote:
> I'm trying to connect to a postgres database (Postgresql-11) within my 
> nodejs-vue.js app, but in console I'm getting this error:
> 
>      [HMR] Waiting for update signal from WDS...
>      pg.js?c8c2:27 Unable to connect to the database: TypeError: 
> net.Socket is not a constructor

>      Environment Info:
> 
>        System:
>          OS: Linux 5.3 Ubuntu 18.04.4 LTS (Bionic Beaver)
>          CPU: (8) x64 Intel(R) Core(TM) i7-4790K CPU @ 4.00GHz
>        Binaries:
>          Node: 12.15.0 - ~/.nvm/versions/node/v12.15.0/bin/node
>          Yarn: 1.22.4 - ~/.nvm/versions/node/v12.15.0/bin/yarn
>          npm: 6.14.4 - ~/.nvm/versions/node/v12.15.0/bin/npm
>        Browsers:
>          Chrome: 81.0.4044.92
>          Firefox: 75.0
>        npmGlobalPackages:
>          @vue/cli: 4.2.3
> 
> So... how to solve the problem?

 From what I can gather the issue is that the code is running in the 
context of the browser and net.Socket is not supported there. It seems 
that the fix is to run the database code in node.js and pass the data 
from there to vue.js. Honestly, this whole reactive code thing is still 
something I'm wrapping my head around. I did find some tutorials 
searching on 'node.js vue.js Sequelize postgresql'. Most seemed to use 
express.js as the glue between node and vue.


> Looking forward to your kind help.
> Marco


-- 
Adrian Klaver
adrian.klaver@aklaver.com





view thread (6+ messages)  latest in thread

Message-ID: <e6692a5d-46ee-5703-d4fb-11437870e89c@aklaver.com>
Permalink:  ../e6692a5d-46ee-5703-d4fb-11437870e89c@aklaver.com/
Also on:    postgresql.org/message-id/e6692a5d-46ee-5703-d4fb-11437870e89c@aklaver.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: adrian.klaver@aklaver.com, ippolito.marco@gmail.com
  Subject: Re: Unable to connect to the database: TypeError: net.Socket is not a constructor
  In-Reply-To: <e6692a5d-46ee-5703-d4fb-11437870e89c@aklaver.com>
  References: <CAFegzBQVR723sRfSR_x9=iVuuTV+dtEK5C=kNuhyJCoZxdaZUg@mail.gmail.com> <e6692a5d-46ee-5703-d4fb-11437870e89c@aklaver.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox