Please verify that the PG data directory is being passed in. This can be done by setting the PGDATA environment variable or by sending in the --pgdata=<pd data directory> with pg_basebackup command.
We are getting below error aand backup is getting failed ....
pg_basebacmup: could not get write-ahead log end position from server: ERROR: could not stat file or directory "./base/16454/14962505": Permission denied.