mrSidX
1
I have a module specified in functionGlobalContext
cloudfrontSigner: require ('@aws-sdk/cloudfront-signer')
I plan to use this in a function
node, but I'm having trouble importing the function.
Traditional node.js code will look like this:
import { getSignedURL } from '@aws-sdk/cloudfront-signer'
I have imported into the function node using this method:
let CFS = global.get('cloudfrontSigner') //as listed in functionGlobalContext { ... }
How can I access or import the getSignedURL
function from this sdk?
I want to do something like this ie:
CFS.getSignedURL({ ... });
But I am getting error "TypeError: CFS.getSignedURL is not a function"
How do we import these functions in a function node?
mrSidX
3
In the code I posted I've gotten past the error and onto the next:
"Error: Invalid policy"
So I am afraid my original issue was merely due to a case-sensitive typo.
I've come across the naming error:
In this code it should be: getSignedUrl
and not getSignedURL
I will look into your suggestion for the mean time.
mrSidX
4
Ahhh. I see this was implemented back in 1.3?
I remember using NR before 1.0, and I guess I've never really gotten to use this, nor remembered it was an implementation.
https://nodered.org/docs/user-guide/writing-functions#using-the-functionexternalmodules-option
mrSidX
5
The policy parameters were entered incorrectly as well:
msg.payload = CFS.getSignedUrl({
url :domain + '/content/demo.mp3',
dateLessThan : new Date(Date.now() + 1000 * 60 * 60 * 24),
privateKey: privateKey,
keyPairId: 'K3LQ6E4XYZABCDEFG'
})
The dateLessThan
was using the key: expires
.
This is resolved.
This is pertaining to the AWS-SDK for CloudFront Signer
system
Closed
6
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.