Stripe webhook test error 302 - node.js

I am trying to test a stripe webhook for subscription trial ending. When I go to send the test even to my webhook receiving route I get error 302. I am using a middleware called stripe-webhook-middleware. My route looks like this:
app.post('/stripe/events',
stripeWebhook.middleware,
stripeEvents
);
I know that route goes against what they docs say but I did get it directly from the package creator. So it should work, then I have the stripe-events.js from the package. I am just adding in a console.log to the route to find the correct data I need.
I tried different webhooks and all give the same error, it has to be in how I have it set up. I hope anyways.
Edit **
I have also done a new route that is just a basic post route with a console.log and still getting the 302 error. What could possible causes be? I can't post a github because of a credential I accidentally leaked.

I am/was using cloud9.io as my development environment and had my test site as private. That was causing stripe to need to login in order to do anything. I made it public and now it works. I had completely forgotten I had to login to see the site because I always was logged in to cloud 9 when I accessed the site. If you are getting a 302 error, make sure you don't need to log in to get to that route.

Just in case anyone sees this 302 error with Codeigniter 3, my webhook route was pointing to a Subscription controller that always exits the constructor if a user isn't logged in and authorised - so I moved the method to my Home controller (used for registration, login etc) thus:
$route['webhook']['post'] = 'home/webhook';
and the 302 error went away. I hope this helps a tired CI dev down the road.

Just in case someone receives this error with dJango, my webhook route was pointing to a language redirection. You can investigate it with curl -IvL http://localhost:8000/webhooks/stripe as #duck suggested above.
Here was my output:
HTTP/1.1 302 Found
...
* Issue another request to this URL: 'http://localhost:8000/en/webhooks/stripe/'
...
You can see the redirected URL in the output.
So, when I let Stripe CLI listen to that URL, it works:
stripe listen --forward-to localhost:8000/en/webhooks/stripe/

Related

500(Internal Server Error): Forge deployed on Azure

I am new to this topic. I have deployed my app to Azure (following the tutorial from Autodesk). When I try to press to the login to BIM360 is return an error 500 (internal Server Error). I have changed the FORGE_CALLBACK_URL = "htttp://forgeSample1234.azurewebsite.net/api/forge/callback/oauth"
The code has no problem when in localhost.
Does anyone has the same problem?
Please note that when updating the callback URL, you actually have to change it in two places:
in your code (that's typically the FORGE_CALLBACK_URL)
in your Forge app page in https://forge.autodesk.com/myapps
And of course, the URL has to match exactly in both places.
Also, it looks like there might be a typo in your URL: you say htttp instead of http, and I'm also wondering if you shouldn't be using https?

Cypress can't access a website from its automated browser (used to work normally and other browsers access normally)

I was hoping one of you could help me out here. I ran out of ideas already.
I have a script with Cypress.io that basically access a website and clicks on a link for LOGIN. I have reduced the code to only access the LOGIN page directly, which was working perfectly for the past 1-2 months, but in the past week I ran the script and it's no longer working.
When it tries to access the URL https://sso.tce.sp.gov.br/cas-server/login it gives the error below.
The most weird thing is that I can access this URL manually from the other non-automated (EDGE, Chrome), but when I try to do it with the Cypress automated browser it doesn't work.
cy.visit() failed trying to load:
https://sso.tce.sp.gov.br/cas-server/login
We attempted to make an http request to this URL but the request
failed without a response.
We received this error at the network level:
Error: Parse Error: Duplicate Content-Length
Common situations why this would fail:
you don't have internet access
you forgot to run / boot your web server
your web server isn't accessible
you have weird network configuration settings on your computer
Apparently it's doesn't look like a proxy thing nor a code thing, do you guys have any idea of what it could be?
Code:
describe('Test', () => {
it('Access AUDESP Website', function () {
Cypress.config('chromeWebSecurity',false);
//cy.visit('https://www.tce.sp.gov.br/audesp')
//cy.get('.menu-superior-itens > [href="https://sso.tce.sp.gov.br/cas-server/login"]').click()
cy.visit('https://sso.tce.sp.gov.br/cas-server/login')
})
})
Any ideas would be very helpful!!
Thank you!
UPDATE:
Guys, I'm still with this error, but I have found out that the website is sending a duplicate header, but cypress is not able to process it. The browser, outside of Cypress, ignores it apparently... any ideas on how to fix it on Cypress?

How to figure out which Instagram user has deauthorized your app with deauthorization callback url

I have followed the procedure at
https://developers.facebook.com/docs/instagram-basic-display-api/getting-started
The last step of step2 is the deauthorization callback;
https://developers.facebook.com/docs/instagram-basic-display-api/getting-started#deauthorize-callback-url
When I enter a callback url for it, it does call my endpoint correctly, however it's just an HTTP POST and does not contain any body or query parameters or anything I can use to figure out which user deauthorized. I think I'm missing something here.
The instructions guide you to this
https://developers.facebook.com/docs/games/gamesonfacebook/login#parsingsr
But again the HTTP POST still does not give me that signed_request.
My app is still in development status on the dashboard. This may be the problem but I don't think it is or should be because I should be able to test without releasing.
Please let me know if you know how to figure out the user who deauthorized your app.
Thanks!

HTTP Error 405.0 - Method Not Allowed while Form Post

I posted a request to payu server via form submit using angularjs now once payment is completed payu will return a response with hash.But when it hits my success page i get "HTTP Error 405.0 - Method Not Allowed".I found many solutions online but none of that solved my issue.What i understood is that static html do not allow post by default.But my staticFile in IIS is like below
Request Path : *
Module : StaticFileModule
Name : staticFile
Request Restriction >Verb > All Verbs & Access > Script & Invoke > Files and folders
My question now in how to allow POST method for html page.I am using angular and if i change my success url to other than mine it works fine.I think there is some changes to be made to the web config but i tried my best but failed.Any help would be much appreciated.Also lets assume that the page successfully redirects to my success page how to capture the response that payu sends me online.
Thanks in advance if more input is needed from my side kindly ask in reply.
It's not that HTML does not allow POST by default, it's that HTML does not handle POST, period. (Not even if the HTML file contains JavaScript.) POST sends data to a script that runs on your server, and the script has to be smart enough to know what to do with the data. HTML isn't that smart. The only thing your server can do with HTML is to send the HTML back to whatever is requesting it. You need a server-side script that knows how to parse payu's response, do something appropriate with the hash, and then generate some HTML to display in the user's browser.

Nest Javascript Thermostat sample not working - 400 Bad Request

I've built the sample app from here: https://developer.nest.com/documentation/cloud/control/
I've created a Client configuration on the developer site with the callback url http://localhost:8080.
The app loads and brings you to the Nest login screen. After entering details it should redirect back but instead the URL https://home.nest.com/session fails with a 400 Bad Request and the response:
{"error":"invalid_request","error_description":"missing user credentials"}
Has anyone got this sample working lately? I believe it's failing in the server.js file at this line (but I'm no Node expert unfortunately):
app.get('/auth/nest', passport.authenticate('nest'));
I've replaced the firebase.js file with the version from the Nest site. Could this be a bug in a recent version of Express or the Nest Passport library?
Tried on OSX, Linux and Windows and getting the same issue.
Thanks!
The OAuth Redirect URI in your client for this example should be http://localhost:8080/auth/nest/callback and be sure that your permissions are set for Thermostat read/write.

Resources