У меня есть Chrome расширение. Он использует фоновый скрипт. js для публикации и получения данных с веб-сайта python, который обращается к базе данных Mariadb (аналогично MySQL). Локально все работало хорошо.
Затем я переместил python в Elasti c Beanstalk и базу данных в RDS. Веб-сайт AWS и база данных работают нормально, но расширение имеет проблему. Расширение хорошо передает данные в RDS, но я получаю сообщение об ошибке, когда пытаюсь получить данные: flask-env.ivkkarzmwt.us-east-2.elasticbeanstalk.com93’s server IP address could not be found.
Фон. js Консоль просто говорит GET 500: Internal Server error
.
Вот фон. js :
fetch('http://flask-env.ivkhmrzmwt.us-east-2.elasticbeanstalk.com/bootstrap')
.then(function (response) {
return response.text();
}).then(function (text) {
console.log('GET response text:');
// console.log(text); // Print the greeting as text
});
// Send the same request
fetch('http://flask-env.ivkhmrzmwt.us-east-2.elasticbeanstalk.com/bootstrap')
.then(function (response) {
return response.json(); // But parse it as JSON this time
})
.then(function (json) {
console.log('GET response as JSON:');
console.log(json); // Here’s our JSON object
console.log ("here's the sun");
console.log (json.greeting)
var integer = parseInt(json.greeting, 10);
console.log(integer + 1)
})
$.ajax({
type: 'POST',
url: 'http://flask-env.ivkhmrzmwt.us-east-2.elasticbeanstalk.com/bootstrap',
data: articleData,
success: function myFunction(data) {
integer = data;
var myInput = integer
var websitelink = "http://flask-env.ivkhmrzmwt.us-east-2.elasticbeanstalk.com" + myInput;
window.open(websitelink, "MsgWindow", "width=400,height=500");
}