Code Monkey home page Code Monkey logo

Comments (15)

kristijanhusak avatar kristijanhusak commented on June 16, 2024

Does it happen only with AWS RDS or also with a local database?
How are you adding a connection, through the "Add connections", env variable, vim variable, or something else?
It works for me locally when I connect to a docker db.

Is the URL you provided just an example how the URL looks? It points to localhost, and you are mentioning that there is an issue with RDS.

from vim-dadbod-ui.

german-muzquiz avatar german-muzquiz commented on June 16, 2024
  • It also happens with a local database launched with docker
  • I'm adding the connection through the "Add connections" option in the sidebar
  • The url is exactly what I use besides the actual password, I'm opening a local SSH tunnel to connect to the target AWS RDS postgres instance because it runs in a private subnet
  • The special characters in the password are $ and also +, vim-dadbod works by escaping only $

I'm just starting with the plugin so I didn't know there were other means for providing the connection, I'll take a look to see if those work

from vim-dadbod-ui.

kristijanhusak avatar kristijanhusak commented on June 16, 2024

I'm assuming that SSH tunnel is the issue. Did you try using https://github.com/pbogut/vim-dadbod-ssh ?

from vim-dadbod-ui.

german-muzquiz avatar german-muzquiz commented on June 16, 2024

Actually I use AWS session manager to establish the tunnel because the bastion server is not public, so is not an actual SSH connection but rather a command like this:

aws ssm start-session --target ${INSTANCE_ID} --document-name AWS-StartPortForwardingSessionToRemoteHost --parameters "{\"portNumber\":[\"${PORT}\"],\"localPortNumber\":[\"${L_PORT}\"],\"host\":[\"${HOST}\"]}"

However I wonder why it also fails for local postgres launched with docker

from vim-dadbod-ui.

kristijanhusak avatar kristijanhusak commented on June 16, 2024

Does everything work locally or on RDS when there is no $ in the password?
Also, what system are you using?

from vim-dadbod-ui.

german-muzquiz avatar german-muzquiz commented on June 16, 2024

Confirmed that it works locally when there is no $ in the password. I cannot change the RDS password though.

Vim version:

~/code % vim --version
VIM - Vi IMproved 9.1 (2024 Jan 02, compiled Apr 18 2024 20:05:12)
macOS version - arm64
Included patches: 1-350
Compiled by Homebrew

from vim-dadbod-ui.

kristijanhusak avatar kristijanhusak commented on June 16, 2024

Can you try applying this patch to your local vim-dadbod-ui installation and try it again?

diff --git a/autoload/db_ui.vim b/autoload/db_ui.vim
index d944db7..419fd29 100644
--- a/autoload/db_ui.vim
+++ b/autoload/db_ui.vim
@@ -422,7 +422,7 @@ endfunction
 " we don't want to do.
 function db_ui#resolve(url) abort
   let parsed_url = db#url#parse(a:url)
-  let ignored_resolve_schemes = ['ssh']
+  let ignored_resolve_schemes = ['ssh', 'postgres', 'postgresql']
 
   if index(ignored_resolve_schemes, get(parsed_url, 'scheme', '')) > -1
     return a:url

If you added a connection through "Add connection", delete and re-add it.

from vim-dadbod-ui.

german-muzquiz avatar german-muzquiz commented on June 16, 2024

Cool, after adding that patch I was able to connect using the escaped password with $

from vim-dadbod-ui.

kristijanhusak avatar kristijanhusak commented on June 16, 2024

Ok, thanks for testing it. I'll fix it and let you know to give it another test.

from vim-dadbod-ui.

kristijanhusak avatar kristijanhusak commented on June 16, 2024

I pushed a change to master. Can you pull latest changes and see if it works?

from vim-dadbod-ui.

wstewarttennes avatar wstewarttennes commented on June 16, 2024

@kristijanhusak I am experiencing this issue as well with a # in the DB connection string -- I'm on the most recent pull and it's giving me this when running :DBUI:

Error executing Lua callback: .../share/nvim/lazy/lazy.nvim/lua/lazy/core/handler/cmd.lua:48: function db_ui#open[1]..<SNR>55_init[2]..4[25]..6[10]..7[35]..
17, line 6: Vim(if):E716: Key not present in Dictionary: "path !=? '/'"

from vim-dadbod-ui.

kristijanhusak avatar kristijanhusak commented on June 16, 2024

@wstewarttennes in which part of db connection string? Did it work before this change? Does vim-dadbod directly work?

from vim-dadbod-ui.

wstewarttennes avatar wstewarttennes commented on June 16, 2024

@kristijanhusak thanks for the quick reply, in the password field -- I have solved this by using %23 instead of the # symbol in the password string (this can fixed for other special characters in a similar matter). I believe this is also present in vim-dadbod directly (I was able to reproduce error using the :DB command). See this issue: tpope/vim-dadbod#103

from vim-dadbod-ui.

german-muzquiz avatar german-muzquiz commented on June 16, 2024

I confirm that the issue was fixed in the latest pull.

from vim-dadbod-ui.

kristijanhusak avatar kristijanhusak commented on June 16, 2024

Ok great, thanks!

from vim-dadbod-ui.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.