-2

I was trying to create a graph using Apache AGE viewer but I am getting this error:

info: ::ffff:127.0.0.1 - - [05/Mar/2023:19:36:20 +0000] "POST /api/v1/cypher/init HTTP/1.1" 500 88
 {"timestamp":"2023-03-06 01:06:20"}
error: access to library "age" is not allowed
    at Parser.parseErrorMessage (/home/aditya/Apache/age-viewer/backend/node_modules/pg-protocol/src/parser.ts:369:69)
    at Parser.handlePacket (/home/aditya/Apache/age-viewer/backend/node_modules/pg-protocol/src/parser.ts:188:21)
    at Parser.parse (/home/aditya/Apache/age-viewer/backend/node_modules/pg-protocol/src/parser.ts:103:30)
    at Socket.<anonymous> (/home/aditya/Apache/age-viewer/backend/node_modules/pg-protocol/src/index.ts:7:48)
    at Socket.emit (node:events:527:28)
    at Socket.emit (node:domain:475:12)
    at addChunk (node:internal/streams/readable:315:12)
    at readableAddChunk (node:internal/streams/readable:289:9)
    at Socket.Readable.push (node:internal/streams/readable:228:10)
    at TCP.onStreamRead (node:internal/stream_base_commons:190:23) {
  length: 111,
  severity: 'ERROR',
  code: '42501',
  detail: undefined,
  hint: undefined,
  position: undefined,
  internalPosition: undefined,
  internalQuery: undefined,
  where: undefined,
  schema: undefined,
  table: undefined,
  column: undefined,
  dataType: undefined,
  constraint: undefined,
  file: 'dfmgr.c',
  line: '546',
  routine: 'check_restricted_library_name'
}

I have created a new user postgres and have connected to it from apache age viewer, but am getting this error only. The above error was from the logs of Apache AGE Viewer backend while the error on the frontend was:

An error occured
Error Code: 42501

Error Details: undefined

I have earlier created extension age and have also created a graph database from command line but that was from a different user.

Edit: As pointed out by @Ahmar Zaidi, I made the user as super user now I am getting the following errors:

info: ::ffff:127.0.0.1 - - [06/Mar/2023:16:04:24 +0000] "POST /api/v1/cypher/init HTTP/1.1" 500 76
 {"timestamp":"2023-03-06 21:34:24"}

from the backened while I got :

An error occured
Error Code: undefined

Error Details: TypeError: Cannot read properties of undefined (reading 'map')

from the frontend.

6 Answers6

1

The error is reflecting that the user has not the permission of what he is trying to access in Apache AGE.

  • One way of solving this error is to give superuser privilege to the user but it is not recommended due to the security issues.
  • The recommended way is to use GRANT command to give permissions to user for accessing required resources of AGE extension.
adil shahid
  • 125
  • 4
0

This is happening because the newly created user does not have superuser priviliges.

Run ALTER USER <new_user> WITH SUPERUSER;

postgres=# ALTER USER new_user WITH SUPERUSER;
ALTER ROLE
postgres=# \du
                                   List of roles
 Role name |                         Attributes                         | Member of 
-----------+------------------------------------------------------------+-----------
 new_user  | Superuser                                                  | {}
 postgres  | Superuser, Create role, Create DB, Replication, Bypass RLS | {}

In my case postgres is the default user/role so I wasn't able to create a new user named 'postgres'.

Ahmar
  • 584
  • 2
  • 7
  • I added it but now I am getting this error: `Error Code: undefined Error Details: TypeError: Cannot read properties of undefined (reading 'map')` – Aditya Gupta Mar 06 '23 at 16:03
  • I'm getting the same error. Maybe the functionality isn't implemented properly. – Ahmar Mar 06 '23 at 20:05
0

I have encountered the same error but what I tried is to do the same thing to get the privileges needed

GRANT USAGE ON FOREIGN DATA WRAPPER age TO postgres;

regrading the second problem with the map I think it is noticed and soon will be fixed

AmrShams07
  • 96
  • 1
  • 7
0

There are a couple of error messages in the logs:

  • The error code '42501' means that there is a permissions-related issue. You may need to grant the necessary privileges to the AGE extension. This might be the superuser access.

  • The error messages show a time stamp discrepancy where the timestamps in the front end and the back end are different. Make sure that your system is set to the correct timezone to resolve this issue.

0

This error indicates that the new user created does not have the permissions to perform the operation. This can be solved by two methods

1. SUPERUSER privilege to the user

Use this code to create a user with superuser privilege.

CREATE USER <user> SUPERUSER; 

And to grant superuser privilege to already created user

ALTER USER <user> WITH SUPERUSER;

This method is simple but it is not recommended due to security considerations.

2. GRANT the user permission to access necessary files

GRANT USAGE ON FOREIGN DATA WRAPPER age TO <user>;

To perform any of the above operations you need to have a superuser privilege.

abhishek2046
  • 312
  • 1
  • 11
0

The error is showing that the user is not allowed to some permissions which are required to run this.

  1. Give newly created user-required permissions i.e. make it superuser.
  2. Grant only required permissions to run this.