Closed whilefoo closed 3 weeks ago
Locations table is obsolete and was removed
Locations
table was still there to support the part where all the permits are fetched. We could eventually make it a plugin now that we can run actions quickly, that would periodically fetch all the data.
/start
The error messages you are encountering indicate that there is a problem with row-level security policies in your Supabase database, specifically when trying to insert a new row into the locations
table. The error message 'new row violates row-level security policy for table "locations"'
suggests that the current user does not have permission to perform the insert operation due to the defined security policies.
Check Row-Level Security Policies:
locations
table in your Supabase dashboard. Ensure that the policies allow the user or service account making the request to insert rows into this table.Modify Insert Logic:
_getOrCreateIssueLocation
method to ensure that it handles errors more gracefully. For example, if an insert fails due to permissions, you might want to log a more informative message or handle it differently.Testing Permissions:
Check User Roles:
locations
table. This might involve checking your Supabase project's authentication settings and roles.Error Handling:
_getOrCreateIssueLocation
method to provide more context when an error occurs. This will help you debug similar issues in the future.Hereโs an example of how you might modify a policy to allow inserts for a specific role:
-- Allow inserts for authenticated users
CREATE POLICY "Allow authenticated inserts"
ON locations
FOR INSERT
TO authenticated
WITH CHECK (true); -- Adjust this condition based on your requirements
You can enhance error handling in your _getOrCreateIssueLocation
method like this:
async _getOrCreateIssueLocation(issue: { issueId: number; issueUrl: string }) {
let locationId: number | null = null;
const { data: locationData, error: fetchError } = await this._supabase
.from("locations")
.select("id")
.eq("issue_id", issue.issueId)
.eq("node_url", issue.issueUrl)
.single();
if (fetchError) {
console.error("Error fetching location data:", fetchError);
throw new Error(`Failed to retrieve location data: ${fetchError.message}`);
}
if (!locationData) {
const issueItem = await getRepo(parseGitHubUrl(issue.issueUrl));
const { data: newLocationData, error: insertError } = await this._supabase
.from("locations")
.insert({
node_url: issue.issueUrl,
issue_id: issue.issueId,
node_type: "Issue",
repository_id: issueItem.id,
})
.select("id")
.single();
if (insertError) {
console.error("Failed to create a new location:", insertError);
throw new Error(`Failed to create a new location: ${insertError.message}`);
} else {
locationId = newLocationData.id;
}
} else {
locationId = locationData.id;
}
if (!locationId) {
throw new Error(`Failed to retrieve the related location from issue ${JSON.stringify(issue)}`);
}
return locationId;
}
By reviewing and adjusting your row-level security policies and improving error handling, you should be able to resolve the issues you're facing with creating locations in your database. Make sure to test thoroughly after making these changes!
Deadline | Mon, Oct 28, 10:57 PM UTC |
Beneficiary | 0x7245F5Cb278ea948Ab6302Bd911db00Ad4889672 |
[!TIP]
- Use
/wallet 0x0000...0000
if you want to update your registered payment wallet address.- Be sure to open a draft pull request as soon as possible to communicate updates on your progress.
- Be sure to provide timely updates to us when requested, or you will be automatically unassigned from the task.
i hope this issues gets fixed asap, this issue has become a blocker for me to qa my pull requests
@ishowvel What do you mean? This issue is not a blocker for a proper run of the plug-in it just outputs an error.
@ishowvel What do you mean? This issue is not a blocker for a proper run of the plug-in it just outputs an error.
I fixed it after disabling rls for all tables ๐
RLS doesn't matter if you use the service key.
RLS doesn't matter if you use the service key.
Sorry it is my first time using databases in this detail, happy to learn along the way smile ๐
Passed the deadline and no activity is detected, removing assignees: @imabutahersiddik.
Error 42501
indeed means a problem while writing on the table according to postgres. It would mean that there is an RLS issue with the table, probably the key used not having enough privileges. It worked locally fine when I used the service key, maybe the environment value is wrong in this repo? I will check that.
/start
Deadline | Sat, Nov 2, 8:13 AM UTC |
Beneficiary | 0x0fC1b909ba9265A846b82CF4CE352fc3e7EeB2ED |
[!TIP]
- Use
/wallet 0x0000...0000
if you want to update your registered payment wallet address.- Be sure to open a draft pull request as soon as possible to communicate updates on your progress.
- Be sure to provide timely updates to us when requested, or you will be automatically unassigned from the task.
@whilefoo After updating the Supabase key, everything seems to work fine, the permits got saved to the db:
which corresponds to entries in https://github.com/ubiquity-os-marketplace/daemon-pricing/issues/32#issuecomment-2452913605
So believe this is resolved.
I guess we can make a new issue for removing location data because it's obsolete like @0x4007 stated
Passed the deadline and no activity is detected, removing assignees: @gentlementlegen.
@0x4007 I guess this can be closed, not sure if it should be done or not planned.
Maybe link the correct pull that fixed this and if it's not double dipping rewards then it's valid.
There was no pull fixing it, just investigated and updated the secrets which is why I ask.
@gentlementlegen the deadline is at Sun, Nov 3, 6:42 AM UTC
A new workroom has been created for this task. Join chat
View | Contribution | Count | Reward |
---|---|---|---|
Issue | Task | 1 | 30 |
Issue | Comment | 7 | 0 |
Comment | Formatting | Relevance | Reward |
---|---|---|---|
`Locations` table was still there to support the part wh… | 0content: content: p: score: 0 elementCount: 1 result: 0 regex: wordCount: 35 wordValue: 0 result: 0 | 0.8 | 0 |
@ishowvel What do you mean? This issue is not a blocker for a pr… | 0content: content: p: score: 0 elementCount: 1 result: 0 regex: wordCount: 24 wordValue: 0 result: 0 | 0.7 | 0 |
RLS doesn't matter if you use the service key. | 0content: content: p: score: 0 elementCount: 1 result: 0 regex: wordCount: 10 wordValue: 0 result: 0 | 0.9 | 0 |
Error `42501` indeed means a problem while writing on th… | 5content: content: p: score: 0 elementCount: 1 a: score: 5 elementCount: 1 result: 5 regex: wordCount: 56 wordValue: 0 result: 0 | 0.95 | 0 |
@whilefoo After updating the Supabase key, everything seems to w… | 5content: content: p: score: 0 elementCount: 5 img: score: 5 elementCount: 1 result: 5 regex: wordCount: 40 wordValue: 0 result: 0 | 0.9 | 0 |
@0x4007 I guess this can be closed, not sure if it should be don… | 0content: content: p: score: 0 elementCount: 1 result: 0 regex: wordCount: 17 wordValue: 0 result: 0 | 0.6 | 0 |
There was no pull fixing it, just investigated and updated the s… | 0content: content: p: score: 0 elementCount: 1 result: 0 regex: wordCount: 17 wordValue: 0 result: 0 | 0.85 | 0 |
View | Contribution | Count | Reward |
---|---|---|---|
Issue | Comment | 2 | 1.184 |
Comment | Formatting | Relevance | Reward |
---|---|---|---|
Locations table is obsolete and was removed | 0.52content: content: p: score: 0 elementCount: 1 result: 0 regex: wordCount: 7 wordValue: 0.1 result: 0.52 | 0.8 | 0.416 |
Maybe link the correct pull that fixed this and if it's not doub… | 1.28content: content: p: score: 0 elementCount: 1 result: 0 regex: wordCount: 20 wordValue: 0.1 result: 1.28 | 0.6 | 0.768 |
View | Contribution | Count | Reward |
---|---|---|---|
Issue | Comment | 3 | 0.54075 |
Comment | Formatting | Relevance | Reward |
---|---|---|---|
i hope this issues gets fixed asap, this issue has become a bloc… | 1.28content: content: p: score: 0 elementCount: 1 result: 0 regex: wordCount: 20 wordValue: 0.1 result: 1.28 | 0.7 | 0.224 |
I fixed it after disabling rls for all tables ๐ | 0.65content: content: p: score: 0 elementCount: 1 result: 0 regex: wordCount: 9 wordValue: 0.1 result: 0.65 | 0.9 | 0.14375 |
Sorry it is my first time using databases in this detail, happy … | 1.17content: content: p: score: 0 elementCount: 1 result: 0 regex: wordCount: 18 wordValue: 0.1 result: 1.17 | 0.6 | 0.173 |
View | Contribution | Count | Reward |
---|---|---|---|
Issue | Specification | 1 | 3.33 |
Issue | Comment | 1 | 1.037 |
Comment | Formatting | Relevance | Reward |
---|---|---|---|
```Failed to create a new location {code: '425… | 1.11content: content: p: score: 0 elementCount: 1 result: 0 regex: wordCount: 17 wordValue: 0.1 result: 1.11 | 1 | 3.33 |
I guess we can make a new issue for removing location data becau… | 1.22content: content: p: score: 0 elementCount: 1 result: 0 regex: wordCount: 19 wordValue: 0.1 result: 1.22 | 0.85 | 1.037 |
https://github.com/ubiquity-os-marketplace/text-conversation-rewards/actions/runs/11165001249/job/31035657102#step:7:443