Reddit Authentication 429

Hey,
I am trying to connect a reddit node, but n8n only returns:
{"code":0,"message":"429","hint":""}
How do I fix this?
output

1 Like

Hey @Zottelchen,

That error seems to be Reddit saying “too many requests” so it is rate limited the request. It may not be an n8n as such and is more of a Reddit limitation, Looking on Reddit some other people have also seen it as an issue with a user-agent header.

What version of n8n are you using?

Hey, currently I am at 0.142.0 .

Hi,
sorry for reviving this post.
I’m also getting the same error when I try to connect my account the already connected one, when I try to execute a Reddit Node I get:

ERROR: The service is receiving too many requests from you! Perhaps take a break?

HTTP status 429
NodeApiError: The service is receiving too many requests from you! Perhaps take a break?
    at Object.redditApiRequest (/usr/local/lib/node_modules/n8n/node_modules/n8n-nodes-base/dist/nodes/Reddit/GenericFunctions.js:26:19)
    at processTicksAndRejections (internal/process/task_queues.js:93:5)
    at async Object.execute (/usr/local/lib/node_modules/n8n/node_modules/n8n-nodes-base/dist/nodes/Reddit/Reddit.node.js:105:40)
    at async /usr/local/lib/node_modules/n8n/node_modules/n8n-core/dist/src/WorkflowExecute.js:451:47

But I didn’t any request

I see that Reddit needs a custom user-agent, but I don’t see any box or how to change it on the node. I think the node is using the default axios user-agent, as the HTTP Request node if nothing is specified. It’s strange because it worked for months (The workflow make max 1 request per day/week), maybe reddit blocked the axios user agent

I’m on 0.165.0 on docker

Thanks

Hey @fantasmaformaggino,

Is your workflow doing anything before the Reddit node?

Yes.
There is a RSS node → Split in batches (for one element) → Set node + function node for only new items → Reddit Node that creates a post with the RSS item title + url

EDIT: I did a test workflow and the issue is the same
2022-03-03_15-01-18

I just tried to set up some credentials to test with and I get the same error when trying to connect with OAuth, I am not sure if we need to change something or if Reddit is having a bit of a moment. I can’t see anything on their status page though.

Maybe is having something about this user-agent thing.
Maybe they blocked the default axios one. It worked 26 days ago. Maybe an option to include a custom user-agent string?
Like the Reddit API rules says here: API · reddit-archive/reddit Wiki · GitHub

Hey @fantasmaformaggino,

I did wonder that but looking at our code we already set a custom user agent of n8n, If I get a chance this afternoon I will do some poking with Curl / Postman to see if I can spot anything odd.

1 Like

Thank you!

Hi, @jon
I tried more things about this issue.
I changed the user-agent (after exploring a little bit throught directories in the container) in Reddit GenericFunctions.js file, thinking n8n user-agent was blocked, but without success.

Next I thought “Maybe reddit now needs a specific user-agent even for the auth” (By default, if I’m not wrong, in the oauth implemented on n8n, it’s in use a generic user-agent). Tried to add in DEFAULT_HEADERS of client-oauth2.js but nothing, still the same error.

I tried now the windows desktop application and, after setting up a new reddit credential… It worked… (Unmodified Files)
And I can make operations

But now… Why on the docker version isn’t? (debian image and classic image)

That is interesting, They use a lot of the same code so I would have expected the same issue. Do the new reddit credentials work in the container?

If I try to use the same client ID and secret ID, it doesn’t: 429
I don’t know how to export on windows client. I checked the CLI commands but on the cmd (and powershell) the command was not found. If I try to execute the command in the program folder there is a infinite loop of instance execution.

UPDATE:
I copied the config and database.sqlite file from Windows Desktop into a folder that I assigned later to another docker container of n8n (and new thing. The latest image n8nio/n8n:latest on arm now gives an exec error. So I used the same version as the main docker container). And… The credentials worked! So… It’s an issue during the auth process. (Maybe even during the token renewal)

P.S. I already tried to create a new container and the issue was still here, so it isn’t a coincidence.

That is interesting, So it could be something with the HTTP library but I think we use the same one for both. It could be worth setting N8N_USE_DEPRECATED_REQUEST_LIB=true to see if that helps.

Unfortunately I tried using that env, but nothing…

More tests done, but without success.

I tried to analyze the requests made from the container and from the win app. (Replacing the accessTokenUrl in RedditOAuth2Api.credentials.js to http://localhost:8000 and using the netcat-openbsd utility into the container (and in the linux subsystem for the win desk app case).
They seems like the same.

Docker container

POST / HTTP/1.1
accept: application/json, application/x-www-form-urlencoded
content-type: application/x-www-form-urlencoded
authorization: Basic [redacted - base64]
content-length: 146
user-agent: Popsicle (https://github.com/serviejs/popsicle)
accept-encoding: gzip, deflate, br
Host: localhost:8000
Connection: keep-alive

code=[redacted]&grant_type=authorization_code&redirect_uri=[redacted]

Windows Desktop app

POST / HTTP/1.1
accept: application/json, application/x-www-form-urlencoded
content-type: application/x-www-form-urlencoded
authorization: Basic [redacted - base64]
content-length: 163
user-agent: Popsicle (https://github.com/serviejs/popsicle)
accept-encoding: gzip, deflate, br
Host: localhost:8000
Connection: keep-alive

code=[redacted]&grant_type=authorization_code&redirect_uri=[redacted]

I even tried to replace the folders of popsicle package from the win app to the container but nothing. It should be another thing…

I did this check because I did see another user having a similar problem but on Golang, regarding a HTTP/2 issue with reddit these days, so I thought to try to see if the issue was the same here but I don’t think (In reality I don’t know). This is the related reddit: “Getting nothing but 429 responses when using Go (golang) client. Same requests work everywhere other than go apps.

I will try more, if I can’t succeed, I will (try to) use another service for reddit as temp workaround and making requests using the HTTP node.

EDIT: I will use that workaround. Let’s see in the future if the things change

1 Like

Hey @fantasmaformaggino,

If you get a chance can you try again? I was having the same issue and now it seems to be fine.

1 Like

Thank you for the information! Now it works :smiley:
I can now reuse my reddit nodes instead of that workaround

1 Like

Hey @fantasmaformaggino,

That is good news, I spent all day Friday trying to work it out and I tried a bunch of different things. Had a chat with @krynble today to get to the bottom of it and without any changes on our side it just started working even after failing at the start of the call.

It is crazy but we suspect something changed on Reddits side at about 1:40 (GMT) today and that has resolved the problem.

1 Like