Skip to content
This repository was archived by the owner on Oct 18, 2023. It is now read-only.

"Not a directory" error on GitHub Actions / Homebrew #288

Closed
karlhorky opened this issue Mar 12, 2023 · 8 comments
Closed

"Not a directory" error on GitHub Actions / Homebrew #288

karlhorky opened this issue Mar 12, 2023 · 8 comments

Comments

@karlhorky
Copy link

karlhorky commented Mar 12, 2023

Hi there, first of all, thanks for sqld, really cool idea!

I wanted to try this out on GitHub Actions CI on a Ubuntu runner and I ran into this error after installing via Homebrew:

$ sqld -d chinook.db -p 127.0.0.1:5432 --http-listen-addr=127.0.0.1:8000 &
_____/\\\\\\\\\\\__________/\\\________/\\\______________/\\\\\\\\\\\\____        
 ___/\\\/////////\\\_____/\\\\/\\\\____\/\\\_____________\/\\\////////\\\__       
  __\//\\\______\///____/\\\//\////\\\__\/\\\_____________\/\\\______\//\\\_      
   ___\////\\\__________/\\\______\//\\\_\/\\\_____________\/\\\_______\/\\\_     
    ______\////\\\______\//\\\______/\\\__\/\\\_____________\/\\\_______\/\\\_    
     _________\////\\\____\///\\\\/\\\\/___\/\\\_____________\/\\\_______\/\\\_   
      __/\\\______\//\\\_____\////\\\//_____\/\\\_____________\/\\\_______/\\\__  
       _\///\\\\\\\\\\\/_________\///\\\\\\__\/\\\\\\\\\\\\\\\_\/\\\\\\\\\\\\/___ 
        ___\///////////_____________\//////___\///////////////__\////////////_____

Welcome to sqld!

version: 0.3.0
commit SHA: bf00d227db035f0fad[6](https://github.com/karlhorky/postgres-js-sqld/actions/runs/4398945530/jobs/7703146935#step:7:7)cf81f064a6356605f0cd9
build date: 2023-03-12

This software is in BETA version.
If you encounter any bug, please open an issue at https://github.com/libsql/sqld/issues

config:
	- mode: standalone
	- database path: chinook.db
	- listening for HTTP requests on: 12[7](https://github.com/karlhorky/postgres-js-sqld/actions/runs/4398945530/jobs/7703146935#step:7:8).0.0.1:[8](https://github.com/karlhorky/postgres-js-sqld/actions/runs/4398945530/jobs/7703146935#step:7:9)000
	- listening for PostgreSQL wire on: [12](https://github.com/karlhorky/postgres-js-sqld/actions/runs/4398945530/jobs/7703146935#step:7:13)7.0.0.1:5432
	- gprc_tls: no
Error: Not a directory (os error [20](https://github.com/karlhorky/postgres-js-sqld/actions/runs/4398945530/jobs/7703146935#step:7:21))

I guess it's probably a misconfiguration on my part, but I can't see where... 🤔

@MarinPostma
Copy link
Contributor

Hello @karlhorky ! The issue is that the database path should not be a SQLite file. sqld creates and manages its own directory; you can't just open a SQLite file with sqld.

We are working on making it possible to load a SQLite dump into sqld. This will be released with the next version of sqld released this week :)

@karlhorky
Copy link
Author

karlhorky commented Mar 13, 2023

Ohh understood! I didn't get that from this first Getting Started example in the readme at a first glance - foo.db seemed like it was supposed to be a path to a file to me.

sqld -d foo.db -p 127.0.0.1:5432 --http-listen-addr=127.0.0.1:8000

Screenshot 2023-03-13 at 12 05 58

@karlhorky
Copy link
Author

I'll make sure to pass in a directory path as an argument to -d then, thanks for the note!

@karlhorky
Copy link
Author

Or maybe I misunderstood what you said above - maybe it is indeed a path to a file, but maybe that file should not exist beforehand... I'll try both ways.

karlhorky added a commit to karlhorky/postgres-js-sqld that referenced this issue Mar 13, 2023
@karlhorky
Copy link
Author

karlhorky commented Mar 13, 2023

Did a new commit, here's the updated file + workflow run - I specified -d database.db as a flag, which is a path that does not exist (no file at this path):

The Not a directory error is gone 👍

sqld -d database.db -p 127.0.0.1:5432 --http-listen-addr=127.0.0.1:8000 &
_____/\\\\\\\\\\\__________/\\\________/\\\______________/\\\\\\\\\\\\____        
 ___/\\\/////////\\\_____/\\\\/\\\\____\/\\\_____________\/\\\////////\\\__       
  __\//\\\______\///____/\\\//\////\\\__\/\\\_____________\/\\\______\//\\\_      
   ___\////\\\__________/\\\______\//\\\_\/\\\_____________\/\\\_______\/\\\_     
    ______\////\\\______\//\\\______/\\\__\/\\\_____________\/\\\_______\/\\\_    
     _________\////\\\____\///\\\\/\\\\/___\/\\\_____________\/\\\_______\/\\\_   
      __/\\\______\//\\\_____\////\\\//_____\/\\\_____________\/\\\_______/\\\__  
       _\///\\\\\\\\\\\/_________\///\\\\\\__\/\\\\\\\\\\\\\\\_\/\\\\\\\\\\\\/___ 
        ___\///////////_____________\//////___\///////////////__\////////////_____

Welcome to sqld!

version: 0.3.0
commit SHA: bf00d227db035f0fad[6](https://github.com/karlhorky/postgres-js-sqld/actions/runs/4404519322/jobs/7714229727#step:7:7)cf81f064a6356605f0cd9
build date: 2023-03-13

This software is in BETA version.
If you encounter any bug, please open an issue at https://github.com/libsql/sqld/issues

config:
	- mode: standalone
	- database path: database.db
	- listening for HTTP requests on: 12[7](https://github.com/karlhorky/postgres-js-sqld/actions/runs/4404519322/jobs/7714229727#step:7:8).0.0.1:[8](https://github.com/karlhorky/postgres-js-sqld/actions/runs/4404519322/jobs/7714229727#step:7:9)000
	- listening for PostgreSQL wire on: 127.0.0.1:5432
	- gprc_tls: no
2023-03-13T12:11:58.5[9](https://github.com/karlhorky/postgres-js-sqld/actions/runs/4404519322/jobs/7714229727#step:7:10)8155Z  INFO sqld::http: listening for HTTP requests on [12](https://github.com/karlhorky/postgres-js-sqld/actions/runs/4404519322/jobs/7714229727#step:7:13)7.0.0.1:8000

@karlhorky
Copy link
Author

Now we're on to another error, but this time it's on the side of PostgreSQL / Postgres.js 🤔


> [email protected] start /home/runner/work/postgres-js-sqld/postgres-js-sqld
> tsx index.ts


node:internal/process/esm_loader:97
    internalBinding('errors').triggerUncaughtException(
                              ^
PostgresError: Portal not found for name: "esjwzbwi1c81"
    at ErrorResponse (file:///home/runner/work/postgres-js-sqld/postgres-js-sqld/node_modules/.pnpm/[email protected]/node_modules/postgres/src/connection.js:769:26)
    at handle (file:///home/runner/work/postgres-js-sqld/postgres-js-sqld/node_modules/.pnpm/[email protected]/node_modules/postgres/src/connection.js:472:6)
    at Socket.data (file:///home/runner/work/postgres-js-sqld/postgres-js-sqld/node_modules/.pnpm/[email protected]/node_modules/postgres/src/connection.js:313:9)
    at Socket.emit (node:events:513:28)
    at Socket.emit (node:domain:489:12)
    at addChunk (node:internal/streams/readable:324:12)
    at readableAddChunk (node:internal/streams/readable:297:9)
    at Readable.push (node:internal/streams/readable:234:10)
    at TCP.onStreamRead (node:internal/stream_base_commons:190:23)
    at cachedError (file:///home/runner/work/postgres-js-sqld/postgres-js-sqld/node_modules/.pnpm/[email protected]/node_modules/postgres/src/query.js:171:23)
    at new Query (file:///home/runner/work/postgres-js-sqld/postgres-js-sqld/node_modules/.pnpm/[email protected]/node_modules/postgres/src/query.js:36:24)
    at sql (file:///home/runner/work/postgres-js-sqld/postgres-js-sqld/node_modules/.pnpm/[email protected]/node_modules/postgres/src/index.js:111:11)
    at <anonymous> (/home/runner/work/postgres-js-sqld/postgres-js-sqld/index.ts:5:7)

Node.js v18.14.2

The file: https://github.com/karlhorky/postgres-js-sqld/blob/main/index.ts

import postgres from 'postgres';

const sql = postgres({ host: '127.0.0.1' });

@MarinPostma
Copy link
Contributor

@karlhorky cool!

This is another error, i'm creating a new issue for it

@MarinPostma
Copy link
Contributor

and closing this one

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants