Hello @Drew_DiPalma thanks for the updates.
I had 3 problems with Realm Functions, I just tested them now, please allow me to share:
1— Stripe, couldn’t make 2 calls in a row using its client:
IT IS WORKING NOW! Thanks!
exports = async() => {
const stripe = require('stripe')(context.values.get('StripeSecretKey'))
const res = await stripe.customers.list()
console.log(JSON.stringify(res))
const res2 = await stripe.customers.list()
console.log(JSON.stringify(res2))
// this second call would just hang forever and fail, it does work now
}
// I'm using latest package stripe 8.216.0
2— AWS SDK v3, S3 Client, it fails just by requiring the client:
IT IS NOT WORKING YET, STILL FAILING
exports = () => {
const { S3Client } = require('@aws-sdk/client-s3')
// just by requiring the client, it fails
}
// using latest @aws-sdk/client-s3 3.67.0
Here is the full error:
> ran at 1649539308006
> took
> error:
failed to execute source for 'node_modules/@aws-sdk/client-s3/dist-cjs/index.js': FunctionError: failed to execute source for 'node_modules/@aws-sdk/client-s3/dist-cjs/S3.js': FunctionError: failed to execute source for 'node_modules/@aws-sdk/client-s3/dist-cjs/S3Client.js': FunctionError: failed to execute source for 'node_modules/@aws-sdk/client-s3/dist-cjs/runtimeConfig.js': FunctionError: failed to execute source for 'node_modules/@aws-sdk/client-sts/dist-cjs/index.js': FunctionError: failed to execute source for 'node_modules/@aws-sdk/client-sts/dist-cjs/STS.js': FunctionError: failed to execute source for 'node_modules/@aws-sdk/client-sts/dist-cjs/STSClient.js': FunctionError: failed to execute source for 'node_modules/@aws-sdk/client-sts/dist-cjs/runtimeConfig.js': FunctionError: failed to execute source for 'node_modules/@aws-sdk/credential-provider-node/dist-cjs/index.js': FunctionError: failed to execute source for 'node_modules/@aws-sdk/credential-provider-node/dist-cjs/defaultProvider.js': FunctionError: failed to execute source for 'node_modules/@aws-sdk/credential-provider-ini/dist-cjs/index.js': FunctionError: failed to execute source for 'node_modules/@aws-sdk/credential-provider-ini/dist-cjs/fromIni.js': FunctionError: failed to execute source for 'node_modules/@aws-sdk/util-credentials/dist-cjs/index.js': FunctionError: failed to execute source for 'node_modules/@aws-sdk/util-credentials/dist-cjs/parse-known-profiles.js': FunctionError: failed to execute source for 'node_modules/@aws-sdk/shared-ini-file-loader/dist-cjs/index.js': FunctionError: failed to execute source for 'node_modules/@aws-sdk/shared-ini-file-loader/dist-cjs/loadSharedConfigFiles.js': FunctionError: failed to execute source for 'node_modules/@aws-sdk/shared-ini-file-loader/dist-cjs/slurpFile.js': TypeError: Cannot access member 'readFile' of undefined
at node_modules/@aws-sdk/shared-ini-file-loader/dist-cjs/slurpFile.js:18:16(34)
at require (native)
at node_modules/@aws-sdk/shared-ini-file-loader/dist-cjs/loadSharedConfigFiles.js:24:27(52)
at require (native)
at node_modules/@aws-sdk/shared-ini-file-loader/dist-cjs/index.js:19:30(41)
at require (native)
at node_modules/@aws-sdk/util-credentials/dist-cjs/parse-known-profiles.js:22:40(34)
at require (native)
at node_modules/@aws-sdk/util-credentials/dist-cjs/index.js:19:30(41)
at require (native)
at node_modules/@aws-sdk/credential-provider-ini/dist-cjs/fromIni.js:16:34(28)
at require (native)
at node_modules/@aws-sdk/credential-provider-ini/dist-cjs/index.js:17:30(32)
at require (native)
at node_modules/@aws-sdk/credential-provider-node/dist-cjs/defaultProvider.js:36:41(51)
at require (native)
at node_modules/@aws-sdk/credential-provider-node/dist-cjs/index.js:17:30(32)
at require (native)
at node_modules/@aws-sdk/client-sts/dist-cjs/runtimeConfig.js:30:42(58)
at require (native)
at node_modules/@aws-sdk/client-sts/dist-cjs/STSClient.js:58:31(94)
at require (native)
at node_modules/@aws-sdk/client-sts/dist-cjs/STS.js:54:27(90)
at require (native)
at node_modules/@aws-sdk/client-sts/dist-cjs/index.js:18:30(35)
at require (native)
at node_modules/@aws-sdk/client-s3/dist-cjs/runtimeConfig.js:26:28(48)
at require (native)
at node_modules/@aws-sdk/client-s3/dist-cjs/S3Client.js:66:31(114)
at require (native)
at node_modules/@aws-sdk/client-s3/dist-cjs/S3.js:224:26(515)
at require (native)
at node_modules/@aws-sdk/client-s3/dist-cjs/index.js:18:30(35)
My goal is to use AWS SDK v3, to replace the third-party services that will be deprecated later the year, so would be good if you could look into.
3— Must have access to the raw request body for Stripe Webhook:
NOT YET, THERE IS NO WAY TO ACCESS THE RAW REQUEST BODY ON WEBHOOKS
// to create the stripe event with need the raw body
// the body.text() does not work
exports = async function({ headers, body }, response) {
const stripe = require('stripe')(context.values.get('StripeSecretKey'))
let event
try {
event = stripe.webhooks.constructEvent(
body.text(), // HERE IS THE ISSUE, WE CAN'T USE THE TEXT
headers['Stripe-Signature'][0],
context.values.get('StripeWebhookSecret'),
)
}
catch (err) {
// ...
}
}
Here is the error that the Stripe library emits:
“Webhook Error: No signatures found matching the expected signature for payload. Are you passing the raw request body you received from Stripe? https://github.com/stripe/stripe-node#webhook-signing ”
For the Stripe Webhook I had to use a PHP server for that.
Wish I didn’t, I have the entire Stripe implementation runing successfully on Realm Functions, only the Webhook I have to do somewhere else.
Thank you very much.