Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Vikunja test connection failed #16

Closed
warhar opened this issue Aug 12, 2024 · 10 comments
Closed

Vikunja test connection failed #16

warhar opened this issue Aug 12, 2024 · 10 comments

Comments

@warhar
Copy link

warhar commented Aug 12, 2024

First, thank you for this integration, I appreciate your time, expertise and generous contribution to Obsidian. Unfortunately, my developer skills are underwhelming and I'm having a difficult time with configuring your plugin.

Steps taken:
Downloaded and installed the obsidian-vikunja-plugin along with its prerequisite plugins
Generated an API token (full access) from my Vikunja account v0.24.1
In the test connection fields of the plugin I added my url (hhtps) and the generated API key
I'm receiving a "Connection Failed" message upon submission
Searched your issues page and Obsidian forums to see if someone else has run into the same issue, to no avail

This is where my developer skills are lacking, I don't know where to find the logs to see examine the error or next steps to resolve it. I would really appreciate any help, hints or pointers in the right direction

Thank you in advance!

@Heiss
Copy link
Owner

Heiss commented Aug 13, 2024

hey,

Please confirm: Your vikunja instance is running at root-level? So something like https://vikunja.your-domain.tld (e.g. like the demo instance https://try.vikunja.io) opens up your instance? No trailing slash or sth. If this is not the case, we need to investigate further.

Also confirm this: If you add /api/v1 to your instance, it returns the same output as the demo-instance https://try.vikunja.io/api/v1 ?

@warhar
Copy link
Author

warhar commented Aug 16, 2024

My apologies
my domain is currently at root level without and trailing slash or sth.

Appending /api/v1 returns
"missing, malformed, expired or otherwise invalid token provided"

steps taken
Confirmed I had a JWT secret set in my compose file
Rebuilt the docker container to the latest ver 0.24.2
Cleared all cache in browser (Firefox)
Searched forums for resolution, I was unable to find a successful solution though other users are seemingly experiencing a similar issue

@Heiss
Copy link
Owner

Heiss commented Aug 16, 2024

Mh. Weird. The api is returning the correct output. From your post, i cannot see any errors.

Okay, we need to go deeper... Please create a new vault in obsidian and install vikunja plugin from community hub, again. Then we can be sure, it is the plugin and nothing else is blocking.

Setup your instance in vikunja plugin settings page (do not enable something else). Please enable the debugging, too. Then press f12 to open up the developer tools in obsidian... Obsidian is a javascript app, so it is something like a browser. ;)

In the new opening frame, you will find a tab named "Console". Open this up, you will see some stuff is going on there.
Now press "Test connection" and look, what the responds is: If everything is fine, you will see something like "SettingsTab: Got tasks: [...]". If something goes south, you should see a big red line with a lot of text.
Read this carefully, there should be hints, what needs to be done. Please post the error log here, if any. Please read through it, so no secrets are leaked.

@warhar
Copy link
Author

warhar commented Aug 17, 2024

Though the output is less than ideal, I appreciate your time and attention, plus it's extra incentive to start my deeper understanding of web technologies

All of these messages are listed without my instance

plugin:vikunja-sync:13040 LabelsAPI: Could not get labels FetchError: The request failed and the interceptors did not return an alternative response at LabelsApi.fetchApi (plugin:vikunja-sync:8810:19) at async LabelsApi.request (plugin:vikunja-sync:8861:22) at async LabelsApi.labelsGetRaw (plugin:vikunja-sync:9735:22) at async LabelsApi.labelsGet (plugin:vikunja-sync:9748:22) at async Label.loadLabels (plugin:vikunja-sync:13035:19) try.vik/api/v1/labels:1 Failed to load resource: net::ERR_NAME_NOT_RESOLVED plugin:vikunja-sync:13040 LabelsAPI: Could not get labels FetchError: The request failed and the interceptors did not return an alternative response at LabelsApi.fetchApi (plugin:vikunja-sync:8810:19) at async LabelsApi.request (plugin:vikunja-sync:8861:22) at async LabelsApi.labelsGetRaw (plugin:vikunja-sync:9735:22) at async LabelsApi.labelsGet (plugin:vikunja-sync:9748:22) at async Label.loadLabels (plugin:vikunja-sync:13035:19) index.html:1 Access to fetch at 'https://try.vi/api/v1/labels' from origin 'app://obsidian.md' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: Redirect is not allowed for a preflight request. try.vi/api/v1/labels:1 Failed to load resource: net::ERR_FAILED plugin:vikunja-sync:13040 LabelsAPI: Could not get labels FetchError: The request failed and the interceptors did not return an alternative response at LabelsApi.fetchApi (plugin:vikunja-sync:8810:19) at async LabelsApi.request (plugin:vikunja-sync:8861:22) at async LabelsApi.labelsGetRaw (plugin:vikunja-sync:9735:22) at async LabelsApi.labelsGet (plugin:vikunja-sync:9748:22) at async Label.loadLabels (plugin:vikunja-sync:13035:19) try.v/api/v1/labels:1 Failed to load resource: net::ERR_NAME_NOT_RESOLVED plugin:vikunja-sync:13040 LabelsAPI: Could not get labels FetchError: The request failed and the interceptors did not return an alternative response at LabelsApi.fetchApi (plugin:vikunja-sync:8810:19) at async LabelsApi.request (plugin:vikunja-sync:8861:22) at async LabelsApi.labelsGetRaw (plugin:vikunja-sync:9735:22) at async LabelsApi.labelsGet (plugin:vikunja-sync:9748:22) at async Label.loadLabels (plugin:vikunja-sync:13035:19) try./api/v1/labels:1 Failed to load resource: net::ERR_NAME_NOT_RESOLVED plugin:vikunja-sync:13040 LabelsAPI: Could not get labels FetchError: The request failed and the interceptors did not return an alternative response at LabelsApi.fetchApi (plugin:vikunja-sync:8810:19) at async LabelsApi.request (plugin:vikunja-sync:8861:22) at async LabelsApi.labelsGetRaw (plugin:vikunja-sync:9735:22) at async LabelsApi.labelsGet (plugin:vikunja-sync:9748:22) at async Label.loadLabels (plugin:vikunja-sync:13035:19) try/api/v1/labels:1 Failed to load resource: net::ERR_NAME_NOT_RESOLVED plugin:vikunja-sync:13040 LabelsAPI: Could not get labels FetchError: The request failed and the interceptors did not return an alternative response at LabelsApi.fetchApi (plugin:vikunja-sync:8810:19) at async LabelsApi.request (plugin:vikunja-sync:8861:22) at async LabelsApi.labelsGetRaw (plugin:vikunja-sync:9735:22) at async LabelsApi.labelsGet (plugin:vikunja-sync:9748:22) at async Label.loadLabels (plugin:vikunja-sync:13035:19) net::ERR_NAME_NOT_RESOLVED plugin:vikunja-sync:13040 LabelsAPI: Could not get labels FetchError: The request failed and the interceptors did not return an alternative response at LabelsApi.fetchApi (plugin:vikunja-sync:8810:19) at async LabelsApi.request (plugin:vikunja-sync:8861:22) at async LabelsApi.labelsGetRaw (plugin:vikunja-sync:9735:22) at async LabelsApi.labelsGet (plugin:vikunja-sync:9748:22) at async Label.loadLabels (plugin:vikunja-sync:13035:19)

The next set of errors replaces the "Failed to load resource: from try/api/v1/labels:1" entry with my instance
and the errors repaeat
I hope this helps

@Heiss
Copy link
Owner

Heiss commented Aug 18, 2024

Nope, it does not help. It seems, that you do not have entered a valid instance, because the error messages coming from deleting one character with backspace in the input field.
Only the last error log helps. In a future release, i will vanish this messages, because they are expected.

Please enter your domain in the input field, regardless if there are error messages in log and click on test and post the error log here. If there is your domain in output, which you do not want to publish, delete it manually.

@warhar
Copy link
Author

warhar commented Aug 18, 2024

Access to fetch at 'https://my.domain.com/api/v1/projects' from origin 'app://obsidian.md' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled. my.domain.com/api/v1/projects:1 Failed to load resource: net::ERR_FAILED plugin:vikunja-sync:8810 Uncaught (in promise) FetchError: The request failed and the interceptors did not return an alternative response at ProjectApi.fetchApi (plugin:vikunja-sync:8810:19) at async ProjectApi.request (plugin:vikunja-sync:8861:22) at async ProjectApi.projectsGetRaw (plugin:vikunja-sync:10170:22) at async ProjectApi.projectsGet (plugin:vikunja-sync:10183:22) at async MainSetting.loadApi (plugin:vikunja-sync:8693:21) index.html:1 Access to fetch at 'https://my.domain.com/api/v1/tasks/all?page=0' from origin 'app://obsidian.md' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled. plugin:vikunja-sync:8795 GET https://my.domain.com/api/v1/tasks/all?page=0 net::ERR_FAILED plugin:vikunja-sync:8492 FetchError: The request failed and the interceptors did not return an alternative response at TaskApi.fetchApi (plugin:vikunja-sync:8810:19) at async TaskApi.request (plugin:vikunja-sync:8861:22) at async TaskApi.tasksAllGetRaw (plugin:vikunja-sync:11206:22) at async TaskApi.tasksAllGet (plugin:vikunja-sync:11219:22) at async Tasks.getAllTasks (plugin:vikunja-sync:11863:12) at async eval (plugin:vikunja-sync:8485:23)

I believe this is what you're looking for

@warhar
Copy link
Author

warhar commented Aug 18, 2024

My instance is sitting behind NGINX Proxy manager if that helps at all

@Heiss
Copy link
Owner

Heiss commented Aug 19, 2024

Ah now we are getting closer.
Okay, you have to configure vikunja, so any origin can connect to your api. See: https://vikunja.io/docs/config-options#cors
Example Config can be found here: https://github.com/go-vikunja/vikunja/blob/main/config.yml.sample#L134
Set cors.enable to true and the rest as it is (especially the origin has to be the *). After a reboot, it should work now.

In a next version, i will try to catch this error and show a notification to mention this.

@warhar
Copy link
Author

warhar commented Aug 19, 2024

Bingo!
I can't thank you enough for this, I appreciate your patience and instructions. You've spurred my motivation to dive deeper into understanding these concepts and protocols versus copying and pasting commands.

@Heiss Heiss mentioned this issue Aug 20, 2024
19 tasks
@Heiss
Copy link
Owner

Heiss commented Aug 20, 2024

No problem.
This is the way to make a better plugin with user friendly notifications and behaviour. ;) It is my first Open Source Project, so i have to learn stuff, too.
Happy to help you.

@Heiss Heiss closed this as completed Aug 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants