I'm trying to send an email with SendGrid. However, it doesn't work. I configured SendGrip as
Setup->Guide->Integrate->Web API->Node.js and get "myKeyFromSendGrid"
I setup the file config/plugins.js
module.exports = ({ env }) => ({ // ... email: { provider: "sendgrid", providerOptions: { apiKey: env( "myKeyFromSendGrid" ), }, settings: { defaultFrom: "test#test.com", defaultReplyTo: "no-reply#test.com", }, }, // ... });
I started my Strapi server, and configured at Roles & Permissions the Email Send to Public. Then, I went to Postman and create a new POST request "http://localhost:1337/email" with this content:
{
"to": "test#example.com",
"from": "test#example.com",
"subject": "Sending with Twilio SendGrid is Fun",
"text": "and easy to do anywhere, even with Node.js",
"html": "<strong>and easy to do anywhere, even with Node.js</strong>"
}
But I keep receiving "Internal Server Error" from Postman, and from Strapi Debug
AssertionError [ERR_ASSERTION]: Cannot wrap non-Error object
at Function.boomify (C:\Users\GustavoRangel\Documents\Development\sandbox\personal_blog\server\node_modules\boom\lib\index.js:107:14)
at formatBoomPayload (C:\Users\GustavoRangel\Documents\Development\sandbox\personal_blog\server\node_modules\strapi\lib\middlewares\boom\index.js:47:22)
at C:\Users\GustavoRangel\Documents\Development\sandbox\personal_blog\server\node_modules\strapi\lib\middlewares\boom\index.js:84:36
at processTicksAndRejections (internal/process/task_queues.js:97:5)
Any idea on what am I doing wrong? I am using Strapi v3.0.1
Related
I saved the model with keras , like : model.save(xx) . And then I converted the keras model to tfjs model ,code like :
# bash
tensorflowjs_converter --input_format keras \
path/to/my_model.h5 \
path/to/tfjs_target_dir
and then I loaded model by
model = await tf.loadLayersModel(MODEL_PATH);
that's all .
My question is :why there is a Uncaught (in promise) Error: Failed to parse model JSON of response from http://mypath/model.json. Please make sure the server is serving valid JSON for this request.
It works well in the localhost,and it does not work in the server .
I really appreciate you help
I've tried in my localhost,and it works well . And My background project is a component library framework named umi. I can directly access the json address on the server in the browser address bar.
Problem:
Power BI report embedding fail and showing "content not available".
Process Followed
Create Azure Directory app as per standard process
Allow user to authenticate from Azure ad authentication and get token
Power BI workspace created / report as well
Get Report Id from Power BI and embed into code
User accessToken got from Azure Ad authentication successful login
Suggestions Needed
I am not sure mapping needed for User, directory and power BI reports. but user for login is already available in active directory + workspace of power bi as well.
It will be great help if one by one process given for exact mapping and access management if required.
const config = {
type: 'report',
accessToken,
embedUrl,
id: embedReportId,
settings: {
filterPaneEnabled: true,
navContentPaneEnabled: true
}
};
var report = powerbi.embed(reportContainer, config);
Content is displaying properly, please take a look into here.
Try to submit the data story with your report URL.
I can successfully connect to the cluster (1 instance for now) from the Cloud9 console using mongo shell, however wasted hours trying to connect to it from within a lambda function.
Setup:
Both cluster and lambda are in the same VPC (default)
TLS is ON
Cluster is in a security group called DemoDocDB which has inbound
rules for 27017 for two security groups: cloud9 and DefaultSG
Lambda is in the default VPC and also in the DefaultSG security group
Code:
config.js
module.exports = {
CONNECTION_STRING: 'mongodb://<user>:<pwd>#xxx.us-east-1.docdb.amazonaws.com:27017',
SSL_CERTIFICATE: returnCerts(), // SSL Cert
DB_NAME: 'documentdb', // Database name
COLLECTION_NAME: 'events' // Tablename;
}
function returnCerts() {
// Trick to avoid filesystem read of https://s3.amazonaws.com/rds-downloads/rds-combined-ca-bundle.pem
return `-----BEGIN CERTIFICATE-----bla blah blah`
}
index.js
const {CONNECTION_STRING, SSL_CERTIFICATE, DB_NAME, COLLECTION_NAME} = require('./config');
const MongoClient = require('mongodb').MongoClient;
let client = null;
exports.handler = (event, context, callback) => {
client = MongoClient.connect(CONNECTION_STRING,
{
sslValidate: true,
sslCA:SSL_CERTIFICATE,
useNewUrlParser: true
},
function(err, client) {
console.log('connection callback invoked')
if(err){
console.log(err)
} })
//callback();
return {
statusCode: 200,
body: JSON.stringify({"message":"hey"})
};
};
Other: Nodejs 12.x, mongodb 3.6.2
Error:
START RequestId: 5e135853-063b-4d5a-8a21-9a29d15c8750 Version: $LATEST
2020-11-01T02:21:43.912Z 5e135853-063b-4d5a-8a21-9a29d15c8750 ERROR (node:9) DeprecationWarning: current Server Discovery and Monitoring engine is deprecated, and will be removed in a future version. To use the new Server Discover and Monitoring engine, pass option { useUnifiedTopology: true } to the MongoClient constructor.
2020-11-01T02:21:54.053Z 5e135853-063b-4d5a-8a21-9a29d15c8750 INFO connection callback invoked
2020-11-01T02:21:54.091Z 5e135853-063b-4d5a-8a21-9a29d15c8750 INFO MongoNetworkError: failed to connect to server [docdb-2020-10-31-23-57-52.cluster-cgzg3t2i3zpn.us-east-1.docdb.amazonaws.com:27017] on first connect [MongoNetworkTimeoutError: connection 0 to docdb-2020-10-31-23-57-52.cluster-cgzg3t2i3zpn.us-east-1.docdb.amazonaws.com:27017 timed out
at Socket.<anonymous> (/var/task/LambdaDBTest/node_modules/mongodb/lib/core/connection/connection.js:421:7)
at Object.onceWrapper (events.js:421:28)
at Socket.emit (events.js:315:20)
at Socket._onTimeout (net.js:482:8)
at listOnTimeout (internal/timers.js:549:17)
at processTimers (internal/timers.js:492:7) {
[Symbol(beforeHandshake)]: true
}]
at Pool.<anonymous> (/var/task/LambdaDBTest/node_modules/mongodb/lib/core/topologies/server.js:438:11)
at Pool.emit (events.js:315:20)
at /var/task/LambdaDBTest/node_modules/mongodb/lib/core/connection/pool.js:562:14
at /var/task/LambdaDBTest/node_modules/mongodb/lib/core/connection/pool.js:995:11
at callback (/var/task/LambdaDBTest/node_modules/mongodb/lib/core/connection/connect.js:75:5)
at /var/task/LambdaDBTest/node_modules/mongodb/lib/core/connection/connect.js:101:9
at _callback (/var/task/LambdaDBTest/node_modules/mongodb/lib/core/connection/connection.js:329:7)
at Connection.errorHandler (/var/task/LambdaDBTest/node_modules/mongodb/lib/core/connection/connection.js:344:7)
at Object.onceWrapper (events.js:422:26)
at Connection.emit (events.js:315:20)
I had a similar timeout issue connecting to a DocumentDB cluster with TLS enabled recently where I had omitted to tell the MongoClient to use SSL... I had the sslValidate and the sslCA option set but had not set the SSL option.
You have to either add ssl: true to your MongClient.connect options or add ssl=true to the connection URL query string. It doesn't look like (from the code snippets) that you're using either?
I have installed masm32 in c:\masm32\. Then, I have created a Build System in ST3:
{
"shell_cmd": "c:\\masm32\\bin\\build.bat \"${file_path}/${file_base_name}\"",
"file_patterns": "[\"*.asm\"]",
"file_regex": "^(..[^:]*):([0-9]+):?([0-9]+)?:? (.*)$",
"selector": "source.asm,source.ASM",
"working_dir": "${file_path}",
"encoding": "utf-8"
}
I can see my new system in the list under the "Build System" menu, but when opening an .asm file and trying to build, I can see the text Line XX, ColumnXX; No Build System at the bottom. It happens also if I explicitly select my Build System.
What is wrong in my configuration?
I have tried this configuration unsuccessfully:
{
"shell": true,
"cmd": ["ml", "/c", "/coff", "$file", "&&",
"link", "/SUBSYSTEM:WINDOWS", "${file/\\.asm/\\.obj/}", "&&",
"explorer.exe", "$file_path"],
"selector": "source.asm"
}
Pressing Ctrl+B still says "No Build system".
I need to pass extra variable to twig, below code loads weekView twig file where I can access node of $week_id but I need to access $image_path as well.
$week_id = $dynamic_week_id; //comes from different node
$image_path = $dynamic_image_path; //comes from different node
$view_week_key = [
'content',
'this_week_wrapper',
'this_week',
'value',
];
$form_state->setValue($view_week_key, "<p>[mailchimp_campaign|entity_type=node|entity_id=" . $week_id . "|view_mode=weekView]</p>");
What kind of twig you are using?
If it's a twig file of node you can get the image by using:
{{ file_url(node.field_name.entity.fileuri)}}