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

Error generating CloudFront signed URL: Error: ENAMETOOLONG: name too long, open '-----BEGIN RSA PRIVATE KEY----- #27

Open
GS2227 opened this issue Dec 26, 2024 · 0 comments

Comments

@GS2227
Copy link

GS2227 commented Dec 26, 2024

const privateKey = "-----BEGIN RSA PRIVATE KEY-----\nLS0tLS1CRUdJTiBQUklWQVRFIEtFWS0tLS0tCk1******** ==\n----- END PRIVATE KEY-----";

export default privateKey;

import * as fs from 'fs';
import privateKeyFolder from "./key.pem";
const privateKeyPath = fs.readFileSync(privateKeyFolder, 'utf8');

const signer = new AWS.CloudFront.Signer(this.cloudFrontKeyPairId, privateKeyPath);
const cfUrl = https://${this.CDNDomain}${filePath};

  const signedUrl = signer.getSignedUrl({
    url: cfUrl,
    expires: Math.floor((Date.now() / 1000)) + 3600
  });
@GS2227 GS2227 closed this as completed Dec 26, 2024
@GS2227 GS2227 reopened this Dec 26, 2024
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

1 participant