Why am I Receiving a 504 Error when Trying to Connect a ServiceNow Instance to Pipedream?

This topic was automatically generated from Slack. You can find the original thread here.

I’m trying to connect a ServiceNow instance according to the instructions in the docs, and I get to the point where I approve the authorization, but then eventually get a 504 error, that lands on a Pipedream URL. Is there a potential issue here? I’ve confirmed the settings within ServiceNow and I’m sure they’re correct, but I don’t know if this timeout is saying that Pipedream didn’t respond to ServiceNow, or that my ServiceNow instance didn’t respond to Pipedream.

Screenshot 2023-08-09 at 8.50.56 AM.png

Hi Kevin, we can help look into this. Could you please share the link to the exact page to the screenshot you’ve taken?

So, very weirdly - when I went back in just now to add a new connected account to get the full URL, there was an active ServiceNow connection, and I just ran a test and it seemed to work….so! That’s a bit of a mystery. Looking at my browser history though, this was the URL:

https://api.pipedream.com/connect/oauth/oa_g2oiqA/callback?code=6eRVFSOSe5xUr8tYz8lU_[…]ate=b19hOEluUm9SfDYyZmZhZWY2YTRhMDgyZTU5YTc3MDExNDRiYTg0Yzli

So if that helps troubleshoot at all, great - otherwise I’ll keep going. I am currently setting up a connection to our dev instance, and OAuth registries get reset when moving between instances, so I’ll have to do this again when we go to test and prod anyway…so if there’s anything to learn, let me know!

Glad to hear it ended up working out for you :slightly_smiling_face:

It may have been an intermittent issue with just the OAuth handler on our end, based on that URL. I’ll forward this along and hopefully we have an error trace we can diganose from

Posted thread to Discourse: Why am I Receiving a 504 Error when Connecting ServiceNow Instance to Pipedream?

Hey there! I don’t know if it makes sense to start a new thread or continue this one - but, as I mentioned above I had to do all the setup again now that I’m moving this to our production environment, I’m getting the same 504 error! This is the URL:

https://api.pipedream.com/connect/oauth/oa_g2oiqA/callback?code=3u3hzOU5_DFuLn-SdXk-O[…]860XvzZIo_yftU7maoGZA&state=93cc4b2b737f4433aac8076039fdc0f5

Anything I ought to try?

Hi Kevin, I’ve let our apps team know about this. Hopefully we’ll find a resolution. But in the meantime, have you checked ServiceNow’s status page? Perhaps they have a partial outage?

Hi Kevin, it looks like at the time you attempted to authenticate - ServiceNow returned a 504 error.

This is not an error on Pipedream’s side. They perhaps have an intermittent issue on their end.

Do the logs happen to shed any light on what exactly was being attempted when the 504 error was returned? The logs in SNOW seem to indicate that the connection was successful, which is obviously wrong…but I’m wondering if I’m looking for the wrong logs, since the initial landing page on the instance where you authorize the app loads fine, the 504 is returned only after clicking Allow

Kevin, we see the errors that are getting raised and the survey you’re submitting (thank you!) — we’re looking into the issue right now.

Did you make any changes in the initial fields you provided when attempting to connect your account? The errors are now getting logged on our end, but we’re getting a 401 from ServiceNow during the OAuth flow, when attempting to request an access token:

{"error_description":"access_denied","error":"server_error"}

FYI it looks like this is likely due to an invalid client secret — can you doublecheck your setup and credentials then try again? cc

I’ve reset the client secret several times - the way SNOW works, when you move the OAuth configurations between instances, they have to be reset anyway; the best guess I have is that there’s a missing role on the service account we’re using to login - is full admin required? I’ve tried applying some out-of-the-box REST and API related roles in SNOW (that we use with other connections) but we obviously try to not to give full admin to most accounts in production!

401 would indicate a credentials issue as Danny mentioned; can you try to connect and let us know if you are still running into issues Kevin? We can take a look at the logs to see what we see on our end. The 504 error to me does not sound like a role-related issue.

Hiya, I’m still seeing the same error and I’m at a loss for where to go next with troubleshooting! Is there anything else we can examine?

If it helps any - I’m sure the issue is with our instance of SNOW, because I spun up a fresh developer instance, and the connection worked. However, I got someone who is a full platform admin on our production instance of SNOW to try to do the authentication, and it still failed, even after resetting the client secret multiple times. So, I’m sure there’s an error on our end somewhere but I’m not sure exactly what it could be or where to look!

Hi Kevin, given that you’re able to test end-to-end with the fresh dev instance, I suspect as you mentioned that it has something to do with your particular instance. I tried testing again in dev and am unable to reproduce the error you’re seeing.

I did a little bit of Googling and found this thread that may be helpful - specifically, the “Things to Check”. There’s another thread here that links to a way to add additional logging. I’m wondering if it has anything to do with the version of the ServiceNow instance as well - when you have spun up a dev instance, is that the same version as the production one? Have you tested this in Postman, and do you also get the same 401 unauthorized error?

Given that this error appears to be on the SNOW side of things as well, it may be helpful to post to their Developer forum as it seems to be quite active as well.

Also wanted to double check that this is set for your production instance:

Ok, so - first yes, In Request Body is set in our prod instance!