meilisearch key permissions #12928

Open
opened 2025-11-02 10:25:16 -06:00 by GiteaMirror · 2 comments
Owner

Originally created by @mapolone on GitHub (Apr 28, 2024).

Description

ISSUE_INDEXER_CONN_STR = "http://xxxx.7700/"

Hello, I'm using a test installation of meilisearch with master key configured and managing keys creation with its API. So far:

  • Created an index named gitea_issues as in configuration file
  • Created a key with the following permissions on the same index as documented here:
"actions": ["search", "documents.*"]
"indexes": ["gitea_issues"]

I'd expect that once set the key, gitea would start normally but I got this error instead:

Apr 28 22:37:16 node gitea[3230588]: 2024/04/28 22:37:16 ...er/issues/indexer.go:111:func1() [F] Unable to issueIndexer.Init with connection http://localhost:7700 Error: unaccepted status code found: 403 expected: [202], MeilisearchApiError Message: The provided API key is invalid., Code: invalid_api_key, Type: auth, Link: https://docs.meilisearch.com/errors#invalid_api_key (path "POST /indexes" with method "CreateIndex")

Using the default admin API key (although not recommended) it works as expected. At this point I'm wondering why is it asking to create a new index when the specified one already exists. And also if I change the previous actions to allow index creations it fails with the same error.

Gitea Version

1.21.11

Can you reproduce the bug on the Gitea demo site?

No

Log Gist

No response

Screenshots

No response

Git Version

2.34.1

Operating System

Ubuntu 22.04.4

How are you running Gitea?

systemd on Ubuntu 22.04.4

Database

PostgreSQL

Originally created by @mapolone on GitHub (Apr 28, 2024). ### Description ISSUE_INDEXER_CONN_STR = "http://xxxx.7700/" Hello, I'm using a test installation of meilisearch with master key configured and managing keys creation with its API. So far: - Created an index named `gitea_issues` as in configuration file - Created a key with the following permissions on the same index as documented [here](https://www.meilisearch.com/docs/reference/api/keys): ``` "actions": ["search", "documents.*"] "indexes": ["gitea_issues"] ``` I'd expect that once set the key, gitea would start normally but I got this error instead: Apr 28 22:37:16 node gitea[3230588]: 2024/04/28 22:37:16 ...er/issues/indexer.go:111:func1() [F] Unable to issueIndexer.Init with connection http://localhost:7700 Error: unaccepted status code found: 403 expected: [202], MeilisearchApiError Message: The provided API key is invalid., Code: invalid_api_key, Type: auth, Link: https://docs.meilisearch.com/errors#invalid_api_key (path "POST /indexes" with method "CreateIndex") Using the default admin API key (although not recommended) it works as expected. At this point I'm wondering why is it asking to create a new index when the specified one already exists. And also if I change the previous actions to allow index creations it fails with the same error. ### Gitea Version 1.21.11 ### Can you reproduce the bug on the Gitea demo site? No ### Log Gist _No response_ ### Screenshots _No response_ ### Git Version 2.34.1 ### Operating System Ubuntu 22.04.4 ### How are you running Gitea? systemd on Ubuntu 22.04.4 ### Database PostgreSQL
GiteaMirror added the type/bug label 2025-11-02 10:25:16 -06:00
Author
Owner

@techknowlogick commented on GitHub (Apr 29, 2024):

The connection string needs to have the key included in it, eg http://:apikey@localhost:7700 (note the prefix of :)

@techknowlogick commented on GitHub (Apr 29, 2024): The connection string needs to have the key included in it, eg `http://:apikey@localhost:7700` (note the prefix of `:`)
Author
Owner

@mapolone commented on GitHub (Apr 29, 2024):

Sorry, there's a typo in the previous message. The apikey is already prefixed by : (from the running configuration):

ISSUE_INDEXER_CONN_STR = http://:300...e65@localhost:7700

@mapolone commented on GitHub (Apr 29, 2024): Sorry, there's a typo in the previous message. The apikey is already prefixed by `:` (from the running configuration): ISSUE_INDEXER_CONN_STR = http://:300...e65@localhost:7700
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#12928