Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

main.CRITICAL: Warning: file_get_contents(): Filename cannot be empty in vendor/amzn/amazon-pay-api-sdk-php/Amazon/Pay/API/Client.php on line 424 #22

Open
Morgy93 opened this issue Feb 17, 2022 · 5 comments

Comments

@Morgy93
Copy link

Morgy93 commented Feb 17, 2022

Hello,

if $key_spec = $this->config['private_key']; on line 421 in https://github.com/amzn/amazon-pay-api-sdk-php/blob/2.2.5/Amazon/Pay/API/Client.php#L421 is empty, then an error is thrown on line 424 for $contents = file_get_contents($key_spec);:

main.CRITICAL: Warning: file_get_contents(): Filename cannot be empty in vendor/amzn/amazon-pay-api-sdk-php/Amazon/Pay/API/Client.php on line 424
@shangamesh
Copy link

Hello
The private_key file path need to configured in the configuration
$amazonpay_config = array(
'public_key_id' => 'PUBLIC_KEY',
'private_key' => 'FILE_PATH', // Example : /Users/xyz/Downloads/private_key.pem'
'sandbox' => true,
'region' => 'us'
);

if the file path is empty then following exception will be thrown
PHP Fatal error: Uncaught ValueError: Path cannot be empty in 'file_path'

if file content is empty then following exception will be thrown
phpseclib3\Exception\NoKeyLoadedException: Unable to read key in 'file_path'

Please configure the file path & make sure file content is not empty

@Morgy93
Copy link
Author

Morgy93 commented Feb 17, 2022

@shangamesh Thanks for the information, but the error is thrown on dev and staging environments where we work with "limited" configured data.

It's never good to have uncaught errors, so it should be fixed nonetheless.

@Dexterzprotege
Copy link
Contributor

@Morgy93
Are you not having any contents in the Config file? And what do you mean by "limited" configurational data?

@Morgy93
Copy link
Author

Morgy93 commented Mar 14, 2022

@Morgy93 Are you not having any contents in the Config file? And what do you mean by "limited" configurational data?

The stage environments have limited data in the env.php file. Basically, everything stripped except necessary things like db connection or base url.

@cfortin
Copy link

cfortin commented Jul 16, 2023

Can someone please expand on the 'config file' that you are referring to? E.g. where should I be able to find this config file? What is it called?

This extension was working fine for us until upgrade and now it's not. The 'Amazon Pay Team' have been pestering us with emails about upgrading the extension (which we have now done, to 5.15.0) but we're still seeing this error.

Many thanks in advance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants