afragen / git-updater-gitlab

GitLab API for Git Updater plugin
MIT License
7 stars 5 forks source link

Getting 404 #3

Closed shaygover closed 1 year ago

shaygover commented 1 year ago

Hi,

I'm getting 404 error.

Query monitor location:

wp-content/plugins/git-updater-gitlab/src/GitLab/GitLab_API.php:293 Fragen\G\A\GitLab_API->get_gitlab_id() wp-content/plugins/git-updater-gitlab/src/GitLab/GitLab_API.php:75 Fragen\G\A\GitLab_API->get_remote_info() wp-content/plugins/git-updater/src/Git_Updater/Base.php:328 Fragen\Git_Updater\Base->get_remote_repo_meta() wp-content/plugins/git-updater/src/Git_Updater/Plugin.php:288 Fragen\Git_Updater\Plugin->get_remote_plugin_meta() wp-content/plugins/git-updater/src/Git_Updater/Base.php:186 Fragen\Git_Updater\Base->get_meta_plugins() wp-content/plugins/git-updater/src/Git_Updater/Base.php:176 Fragen\Git_Updater\Base->load() wp-includes/class-wp-hook.php:308 do_action('init') wp-settings.php:617

Error message:

Undefined property: stdClass::$path

GitLab Plugin URI: https://gitlab.com/<group>/<sub group>/<project>

afragen commented 1 year ago

Can you share the repo URL? If private, can you temporarily add afragen as a contributor?

shaygover commented 1 year ago

Can't give you permission to that specific repo. Gave you permissions to a blank repo. Under the same subgroup. Maintainer permissions.

afragen commented 1 year ago

A blank repo doesn’t help, I’m sorry. Can you post the actual URL to the repo, post the tree structure of the repo and post the main plugin file headers.

shaygover commented 1 year ago

. ├── admin │   ├── class-iframe-inserter-admin.php │   ├── css │   │   └── iframe-inserter-admin.css │   ├── iframe_tinymce_btn_lang.php │   ├── index.php │   └── js │   └── iframe.js ├── iframe-inserter.php ├── includes │   ├── class-iframe-inserter-activator.php │   ├── class-iframe-inserter-deactivator.php │   ├── class-iframe-inserter-i18n.php │   ├── class-iframe-inserter-loader.php │   ├── class-iframe-inserter.php │   └── index.php ├── index.php ├── languages │   ├── iframe-inserter-he_IL.mo │   ├── iframe-inserter-he_IL.po │   └── plugin-name.pot ├── LICENSE.txt ├── public │   ├── class-iframe-inserter-public.php │   ├── index.php │   └── js │   └── iframe-inserter-public.js ├── README.txt └── uninstall.php

Header: ` /**

afragen commented 1 year ago

What is the plugin slug? Because the way it's setup it will be wp-dev

shaygover commented 1 year ago

Should be p-iframe-inserter

wp-dev is the sub group.

afragen commented 1 year ago

I was incorrect above. It should work. I have a Gitlab repo in a <group>/<sub-group> that I test with and it works.

Without testing with the actual repository I can only say that a 404 error is usually an invalid access token. Take a look at the Troubleshooting section, https://git-updater.com/knowledge-base/troubleshooting/ and see if there are any HTTP errors from Query Monitor.

shaygover commented 1 year ago

Been there b4 I opened this issue.

Before I try again with the same tokens. Which api permission those gitlab token need? That seems like the only other problem I can think of.

afragen commented 1 year ago

Token needs read permission for most things. I don't specifically remember what the options for GitLab are. Create a token with full access to everything and see what happens. Git Updater does write anything upstream, it only updates/replaces the downstream code with the upstream code.

afragen commented 1 year ago

It might be that the api is the only one necessary. But I’d add anything that has read or read/write.

shaygover commented 1 year ago

Ok. Culprit found: Branch name is master and not main.

I tested permissions too: User: read_api, read_repository Project: read_api, read_repository as Reporter

Note that starting from gitlab 16.0 (upcoming version), Expiration date for both tokens is mandatory.

Can you add this to the docs?

Also, while testing, I noticed that changing the user token after updating the plugin will result in red ! near the plugin name. But Query manager showed no errors and gitlab gui didn't show any attempt to use the token. Had to delete the target plugin and re upload it.

afragen commented 1 year ago

I've cached errors for an hour, that's likely why you might still see the red warning icon. You can Refresh Cache to clear that.

I didn't know about the expiration date for GitLab tokens, I'll make a note.

shaygover commented 1 year ago

The red ! showed even after a cache refresh

On Tue, Nov 8, 2022 at 9:39 PM Andy Fragen @.***> wrote:

Closed #3 https://github.com/afragen/git-updater-gitlab/issues/3 as completed.

— Reply to this email directly, view it on GitHub https://github.com/afragen/git-updater-gitlab/issues/3#event-7766175665, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACPGR4PSIZUTIRU5T2WTSU3WHKT5JANCNFSM6AAAAAARZFWTM4 . You are receiving this because you authored the thread.Message ID: @.***>

afragen commented 1 year ago

I bet the primary branch was saved in the database. This being the incorrect primary branch. In the near future a web hook will be available to reset this.

https://git-updater.com/knowledge-base/remote-management-restful-endpoints/#articleTOC_2

Next major release will include these features in core plugin.

shaygover commented 1 year ago

Thanks!

On Tue, Nov 8, 2022 at 9:44 PM Andy Fragen @.***> wrote:

I bet the primary branch was saved in the database. This being the incorrect primary branch. In the near future a web hook will be available to reset this.

https://git-updater.com/knowledge-base/remote-management-restful-endpoints/#articleTOC_2

Next major release will include these features in core plugin.

— Reply to this email directly, view it on GitHub https://github.com/afragen/git-updater-gitlab/issues/3#issuecomment-1307743524, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACPGR4PN4ED2VYM2FC27K2TWHKUTXANCNFSM6AAAAAARZFWTM4 . You are receiving this because you authored the thread.Message ID: @.***>