logrocket_deno_api icon indicating copy to clipboard operation
logrocket_deno_api copied to clipboard

Can't execute the tutorial in my machine

Open rafaelcascalho opened this issue 6 years ago • 3 comments

Hi Diogo! I've just followed your tutorial, but something seems to be going wrong.

Here is my github repo. And here is the error message following the deno -A index.js:

Compile https://deno.land/x/oak/mod.ts
error TS2339: Property 'len' does not exist on type 'FileInfo'.

► https://deno.land/x/oak/send.ts:154:55

154   response.headers.set("Content-Length", String(stats.len));

Aditional info

OS: Ubuntu 19.10
deno 0.37.1
v8 8.2.308
typescript 3.8.3

It seems to me to be something from deno itself, but I could not found why. Can you give me a hand?

rafaelcascalho avatar Mar 26 '20 01:03 rafaelcascalho

Hey Rafael, I'm sorry for the delay on this.

I've cloned your project and the only thing is wrong is the Postgres connection. You're using port 5433 (invalid).

In order for the example to work, you need to have the database set up and properly working, with the database pre-created, ok?

Let me know if this fixed your problem. :)

diogosouza avatar Apr 03 '20 13:04 diogosouza

Hey @diogosouza ! No problem, I'm also busy at times here haha

So, I tried changing the port in the database class but it did not work. Locally, I'm using postgres with docker-compose, here is my composer file

version: '3'

services:
  psql:
    image: postgres
    restart: always
    environment:
      POSTGRES_PASSWORD: 'password'
    ports:
      - '5433:5432'
    volumes:
      - './data:/var/lib/postgres/data'

That's why I used the port 5433 instead of 5432, the default port is exposing the postgres in another container of another project.

The following screenshots show that I can connect to the database, which has the beers table

This first one is a connection test using the 5433 port Screenshot from 2020-04-03 17-10-59

This second one shows the database with the beers table created Screenshot from 2020-04-03 17-19-39

I don't seem to figure out what could be :smile: haha.

rafaelcascalho avatar Apr 03 '20 21:04 rafaelcascalho

Hey man.. sorry the delay...

This is so weird 🤔

I've ran your code in my computer, and everything's working fine. I'm afraid that maybe something wrong may be happening between the Deno app and your Docker image.

Can you test the example with a local Postgres database? Instead of the Docker image?

diogosouza avatar May 27 '20 19:05 diogosouza