Resource not found when attempting to send voice message through AWS Pinpoint - javascript

I currently have a Node.js service to send a voice call through AWS Pinpoint. However, I'm getting a Resource not found response after making a call. I tested with PinpointSMSVoice.sendVoiceMessage which succeeds in making the call. The one that doesn't work is Pinpoint.sendMessages. My request object looks like this:
{
ApplicationId: 'project-id',
MessageRequest: {
Addresses: {
['destination-number']: {
ChannelType: 'VOICE',
Substitutions: {
// Using a template
}
}
},
MessageConfiguration: {
VoiceMessage: {
LanguageCode: 'en-US',
OriginationNumber: 'origination-number'
}
},
TemplateConfiguration: {
VoiceTemplate: {
Name: 'voice-template
}
}
}
};
pinpoint.sendMessages(requestObj, callback);
I should note that I am not in sandbox mode, it was approved and moved to production mode. I have tested the same setup with SMS which works perfectly well. I'm not quite sure what the difference is between PinpointSMSVoice.sendVoiceMessage and Pinpoint.sendMessages, except for the fact that Pinpoint.sendMessages allows me to set a template. Any ideas on what else I could be missing?

I'm encountering the same issue. It works using PinPointSMSVoice client, but that won't let me use a template. I've also tested this using V3 of the AWS JS SDK, which modularizes the clients #aws-sdk/client-pinpoint-sms-voice and #aws-sdk/client-pinpoint, but the behaviour is the same. It works uses the same tempplate in the 'Test Message' feature in the console, so seems to be a JS SDK issue. I suggest you raise the issue with JS SDK team https://github.com/aws/aws-sdk-js-v3

When you use PinPoint to perform the sendVoiceMessage operation, you need to set the content type to application/json. If you do not, you get this exception. To see an example (this is the AWS Java API), see this Github URL:
https://github.com/awsdocs/aws-doc-sdk-examples/blob/master/javav2/example_code/pinpoint/src/main/java/com/example/pinpoint/SendVoiceMessage.java

Related

Render PDF in Forge Viewer with PDF Extension - pdf.worker.js throws warning

While trying to render a PDF, which gets served through our own API, the pdf.worker.js throws the following warning and the rendered PDF always keeps being completely white.
And I only see this (it's a wide PDF, but gets correctly rendered within the Demo):
Our Client application is served with angular, however I could not totally encapsulate the problem. With a simple and new angular application I was able to render a PDF File, served from our API but in my bigger client application the error above keeps occurring and I don't know why.
I'm using this Code to load the PDF, which inspired by this GitHub and this Blog Entry from Autodesk.
Autodesk.Viewing.Initializer({ env: 'Development', useADP: false }, () => {
const viewer = new Autodesk.Viewing.GuiViewer3D(
document.getElementById('forgeViewer'),
);
viewer.start();
const url =
'http://api.pdfFileToRender.pdf';
viewer.loadExtension('Autodesk.PDF').then(() => {
viewer.loadModel(
url,
{},
model => {
console.error('Success: ', model);
},
(errorCode, errorMessage, errorArgs) => {
console.error('Error Code: ', errorCode);
console.error('Error Msg: ', errorMessage);
console.error('Error Args: ', errorArgs);
},
);
viewer.loadExtension('Autodesk.Viewing.MarkupsCore');
viewer.loadExtension('Autodesk.Viewing.MarkupsGui');
});
});
The loadModel Function also calls the onSuccessCallback and I see "Success" in my Console.
For me it is not possible to integrate the PDF Extension into my Client App. Does anyone know a solution or have a hint for this, I gladly appreciate it.
It is also important for me, that the PDFs are rendered locally and are not uploaded to any Forge API.
For serving the Client Application I'm using Angular 11.2.7 and Typescript 4.1.5. I'm loading the ForgeViewer with the Version 7.36.0 but the Problem occurs also with other Versions.
For anyone interested, I could figure it out. Our own application was defining array prototype functions. However this is a problem for pdf.js which get's used by the PDF Extension from Forge.
The root problem was by defining array prototype functions like this:
Array.prototype.myFunction = function(...) {...}
We had to either exclude our own array functions or write it that way:
Object.defineProperty(Array.prototype, 'myFunction', {value: function(...) {...})
So, if you application defines array prototype function, use Object.defineProperty or don't use them at all. This seems to solve the Issue. Cheers.

How to add custom header for accessing a page URL and then performing test automation on that page, i am using a webdriverio,mocha,nodejs framework

I have a web page where the functionality changes when a custom header "headerKey": "headervalue" is being set through a chrome extension. While I can do this manually I want to do it through the code in order to do test automation.
Note:-
Please help with the approaches.
There is no functionality in webdriver to perform this operation.
I have used modheader but it is not working.
getModHeaderExtension() {
const filename = path.join(__dirname, "Modify.crx");
console.log(filename);
const stream = fs.readFileSync(filename);
return new Buffer(stream).toString('base64');
}
I know some time passed since the question was added, although it took me some time to figure it out by myself so maybe someone will make use of it.
Add #wdio/devtools-service to your dev dependencies (this should have the same major version as your other #wdio libraries, otherwise you can get some problems)
You need to add devtools to services in wdio.conf.ts:
export const config = {
[...]
services: ['chromedriver', 'devtools']
[...]
}
Now add you can add headers in you test method or wherever you need to:
const encodedCredentials = base64.encode(`${appConfig.basicAuthDevUser.userName}:${appConfig.basicAuthDevUser.password}`);
browser.cdp('Network', 'setExtraHTTPHeaders', {
headers: {
Authorization: `Basic ${encodedCredentials}`,
},
});
More on using devtools with wdio:
https://webdriver.io/docs/devtools-service/
More on chrome specific capabilites:
https://chromedevtools.github.io/devtools-protocol/tot/Network/
I was able to find the solution to pass a custom header while opening my webpage.
I am using ChromeDevTools service which is supported by webdriverio v5, using its method
browser.cdp(domain, command, parameters);
For the domain, command, and parameters please visit devtools protocol below:-
https://chromedevtools.github.io/devtools-protocol/

firebase functions get error stream removed onCreate firestore event

I'm worried about this error on firebase functions,
I have a sendgrid dispatch on this function:
exports.mailDealings = functions.firestore
.document('dealings/current').onCreate(event => {
// send mail
const msg = {...}
sgMail.send(msg);
})
.catch(result => {
console.error("sendgrid error", result);
});
I was able to execute with success before but on one call,
this function give me the error below:
{ Error: Stream removed
at ClientReadableStream._emitStatusIfDone (/user_code/node_modules/firebase-admin/node_modules/grpc/src/client.js:255:19)
at ClientReadableStream._receiveStatus (/user_code/node_modules/firebase-admin/node_modules/grpc/src/client.js:233:8)
at /user_code/node_modules/firebase-admin/node_modules/grpc/src/client.js:705:12 code: 2, metadata: Metadata { _internal_repr: {} } }
There should have an automatic retry for this error, right?
Or at least a method for turning this easy, like result.retry(1000)?
Same problem here (in many functions & randomly) since 3 / 4 days.
Apparently t disappears after deploy...for few minutes
Error: Stream removed
at ClientReadableStream._emitStatusIfDone (/user_code/node_modules/firebase-admin/node_modules/grpc/src/client.js:255:19)
at ClientReadableStream._receiveStatus (/user_code/node_modules/firebase-admin/node_modules/grpc/src/client.js:233:8)
at /user_code/node_modules/firebase-admin/node_modules/grpc/src/client.js:705:12
From the Google Groups discussion on this bug:
Hello all, Sebastian from the Firestore SDK team here. We believe this
issue is related to the recent update of the GRPC Client SDK and have
been running tests with GRPC 1.7.1. So far, we have not been able to
reproduce this issue with this older GRPC version.
#google-cloud/firestore is now at 0.10.1. If you update your
dependencies, you will be able to pull in this release.
Thanks for your patience.
Sebastian
This seems to have fixed the issue for me!

Chrome WebRTC breaks on browser update with adapter.js

I suddenly get the following error on my webapp when using chrome:
Failed to construct 'RTCPeerConnection': Failed to initialize native PeerConnection.
I believe it was because of a chrome update
I'm using adapter.js v1.0.2(latest)
This doesn't occur in firefox. I think it's because of my constraints object. Here it is
options = {
iceServers:[
{
url:'stun:12.345.678.910:3478'
},
{
url: "turn:#12.345.678.910:3479",
username:"ninefingers",
credential:"youhavetoberealistic"
}
]
};
I made sure the turn server was running. I think the options object format has changed. Using chrome 48.0.2564.116 on ubuntu and mac os x.
I doubt that this is an adapter.js issue, in your ice server config for turn url, there is an unnecessary #, that must be the issue. Probably firefox just ignores it, but chrome is more strict, change code to:
...
urls: "turn:12.345.678.910:3479",
...
Edit: based on jib's comment that url is deprecated and must be replaced with urls, the new code would be:
options = {
iceServers:[
{
urls:'stun:12.345.678.910:3478'
},
{
urls: "turn:12.345.678.910:3479",
username:"ninefingers",
credential:"youhavetoberealistic"
}
]
};

Read the phone number of device using javascript [duplicate]

Is there any way to fetch user’s phone number in Firefox OS?
If so, any help would be appreciated.
According to Mozilla's app permissions page, there is an permission called "phonenumberservice" but there is no information about it. Anyway, the permision is listed under the "Internal (Certified) app permissions", which means that, when available, it can only be used by "system-level apps and default apps created by Mozilla/operators/OEMs".
With Firefox 2.0 you should be able to use Mobile Identity API:
https://wiki.mozilla.org/WebAPI/MobileIdentity
https://bugzilla.mozilla.org/show_bug.cgi?id=1021594
I believe the permission is:
"permissions": {
"mobileid": {} }
And it is privileged.
So, as #Jason said, the Mobile Identity API provides this capability, and not just for certified, but for privileged applications. So it is no longer just for OEMs.
The Mozilla Wiki site shows the API:
dictionary MobileIdOptions {
boolean forceSelection = false;
};
partial interface Navigator {
Promise getMobileIdAssertion(optional MobileIdOptions options);
};
The site also provides a sample code skeleton for this:
function verifyAssertion(aAssertion) {
// Make use of the remote verification API
// and return the verified msisdn.
// NB: This is necessary to make sure that the user *really* controls this phone number!
}
// Request a mobile identity assertion and force the chrome UI to
// allow the user to change a possible previous selection.
navigator.getMobileIdAssertion({ forceSelection: true })
.then(
(assertion) => {
verifyAssertion(assertion)
.then(
(msisdn) => {
// Do stuff with the msisdn.
}
);
},
(error) {
// Process error.
};
);
For this to work, you need to add the mobileid permission in the manifest file, for example like this (I made up the description):
"permissions": {
"mobileid": {
"description": "Required for sending SMS for two factor authentication",
"access": "readonly"
}
}
PS: I made this answer, because most answers are outdated, and the one that isn't, does not contain all useful information.
References:
App Manifest Documentation
Firefox Remote Verification

Categories

Resources