Apixu recently updated their endpoints(now weatherstack) and I'm having trouble figuring out how to fix my twitter weather bot. I am stuck right now with the following code
now fixed
I'm not sure if you're giving us a snippet or the full file, but you're not invoking your setup function.
You have missed certain things here (If you have sent the whole file content):
1) Import the Twit instance from package of twitter to send the post request.
2) Calling the setup() function from somewhere in the file.
Ok it turns out I forgot to install the axios package, it's working now.
Related
I'm trying to build a mock-up website with a register and login function. Right now I have a register page route script that should run a function (a sql query) from my database script once it receives a post request. For some reason, the function isn't running.
Since I'm not too familiar with NodeJS and SQLite it feels like the problem could be anywhere. It would be great if someone knowledgeable could point in me the right direction:
Doing some testing, I've figured that I'm not ever really reaching the dbcontroller script. Thus why I think there something wrong with my function exporting. But it might be some quirk with NodeJS. I'd love to get any help on it.
edit - I should add that I'm not really getting any error message other than my client being routed to the error page and a error 500 in the console:
POST /register 500 21.775 ms - 4447
I have an issue and i don't even know where should I start the investigation.
I have a website that based on Flask and react, i fetch stock prices from my backend every minute and it seems like when the webpage is not able to fetch the stock prices from the backend, i'm getting the attached popup message and the page got stuck.
I need to close the webpage in order to start use it again.
Can you please give me some direction, what can be the root cause?.
Error message
Thank you very much.
Try to find in the project all lines of code that execute alert(. You'll be able to find the place of a code that executes alert if there is some backend's issue.
I can't for the life of me figure this out, it seems like it should be straight forward but it's just not clicking.
I have an ES6 app that I created using create-react-app. I've got all the templates and layouts set up for the project and came to trying to pull in data from an API that I want to sit inside the app - like a botched MVC where React handles the views and I run the models and controllers in PHP.
So I have a function in one of my components that I want to fetch some data. I use the fetch() function (I know this isn't yet compatible with a number of browsers but that's a problem for another day) to fetch a relative path from the component to the model I want to load, however the fetch function treats my path as a call to the base URL followed by the request. So with the site running on localhost:3000, I run the following code in my getData() function...
let test = fetch('../models/overall-stats.php').then(function(response) {
console.log(response);
return response;
});
...the URL that fetch hits is then http://localhost:3000/models/overall-stats.php which simply resolves back to the index.html file and loads the app, rather than the PHP file I'm requesting.
If I need to hit that PHP file to get my data, am I wrong in using fetch? Or am I just using it incorrectly? If I shouldn't be using fetch what's a better approach to this problem I'm having?
When I run this on an apache server (after building and deploying) I can get the fetches to work fine (apache recognizes the structure of the URL and hits it as I am expecting) and I hit the file no issues, but I need to be able to work in a local development environment and have the same functionality. The app will end up being deployed live on an apache server.
Any help would be greatly appreciated.
I knew after sleeping on this it would be very straight-forward... I simply had to move my models and controllers into the public directory for them to be accessible. I'll be putting in authentication to the models so that they can't be hit directly, but only through GET requests.
Why don't you just use something like ${baseUrl}/models/... ?
Also for solving browsers problem with fetch you can import the Polyfill or simply use axios (my choice)!
Maybe you can try to use ajax to get or post the data from server, just like this:
$.ajax({
url: '../models/overall-stats.php',
data: {
},
type: 'GET',
dataType : 'json',
success : function(res){
let obj = parseJSON(res)
}
})
or add this on top in your php file because the CORS :
header('Access-Control-Allow-Origin: *');
I'm trying to use passthrough for a POST request in this Ember project
this.passthrough('/thirdeye/entity?entityType=ANOMALY_FUNCTION');
This is what the call looks like in app/mirage/config.js.
I got the following error:
Mirage: Your Ember app tried to POST '/thirdeye/entity?entityType=ANOMALY_FUNCTION',
but there was no route defined to handle this request.
Define a route that matches this path in your
mirage/config.js file. Did you forget to add your namespace?
Clearly, I've added that call to the config file, but it's not being picked up. I read that passthrough only works for >= jquery 2.x, which my project is.
Does anyone know what else could cause this?
I found out the problem was I had to do this.passthrough('/thirdeye/***'); since the call has query params. It works now.
The Facebook, Google and Yahoo login for satellizer.js was pretty straight forward. All I had to do was create apps with their respective API's, configure them with my homepage's URL. Then I added the app-ids to the app.js file:
$authProvider.facebook({
clientId: 'xxxxxxxxxxxxxxxxx'
});
and lastly I added the app id and secret in the config.js file server-side.
I thought this would be the process with Twitter too, but their API keeps giving me an error saying
Something is technically wrong. Thanks for noticing—we're going to fix
it up and have things back to normal soon.
and no additional information is given, which leaves me with finding the needle in the haystack.
Are there any additional measures that I need to take to make the Twitter authentication work?
Be sure to set the right twitter secret and key.
I had the same problem until I rrealised that there was a space as the first character in the string of my twitter key.
This causes the same behavior you described