Twitter credentials does not working

Describe the problem/error/question

Twitter is not working, no matter v1 or v2 oauth. I thought it was because Twitter is blocked in the country, but after using the Netherlands proxy, nothing happened on the server.

What is the error message (if any)?

изображение
Error: Client network socket disconnected before secure TLS connection was established

n8n | 2024-09-25T22:18:12.176Z | error | AxiosError: Client network socket disconnected before secure TLS connection was established “{ file: ‘LoggerProxy.js’, function: ‘exports.error’ }”
n8n | 2024-09-25T22:18:12.178Z | error | Error: Client network socket disconnected before secure TLS connection was established “{ file: ‘LoggerProxy.js’, function: ‘exports.error’ }”

version: '3'
services:
  traefik:
    image: "traefik"
    restart: always
    command:
      - "--api=true"
      - "--api.insecure=true"
      - "--providers.docker=true"
      - "--providers.docker.exposedbydefault=false"
      - "--entrypoints.web.address=:80"
      - "--entrypoints.web.http.redirections.entryPoint.to=websecure"
      - "--entrypoints.web.http.redirections.entrypoint.scheme=https"
      - "--entrypoints.websecure.address=:443"
      - "--certificatesresolvers.mytlschallenge.acme.tlschallenge=true"
      - "--certificatesresolvers.mytlschallenge.acme.email=${SSL_EMAIL}"
      - "--certificatesresolvers.mytlschallenge.acme.storage=/letsencrypt/acme.json"
      - "--log.level=DEBUG"
    ports:
      - "80:80"
      - "443:443"
    volumes:
      - ./traefik_data:/letsencrypt
      - /var/run/docker.sock:/var/run/docker.sock:ro
    networks:
      - traefik-network

  n8n:
    image: docker.n8n.io/n8nio/n8n
    container_name: n8n
    ports:
      - '5678:5678'
    labels:
      - traefik.enable=true
      - traefik.http.routers.n8n.rule=Host(`${SUBDOMAIN}.${DOMAIN_NAME}`)
      - traefik.http.routers.n8n.tls=true
      - traefik.http.routers.n8n.entrypoints=web,websecure
      - traefik.http.routers.n8n.tls.certresolver=mytlschallenge
      - traefik.http.middlewares.n8n.headers.SSLRedirect=true
      - traefik.http.middlewares.n8n.headers.STSSeconds=315360000
      - traefik.http.middlewares.n8n.headers.browserXSSFilter=true
      - traefik.http.middlewares.n8n.headers.contentTypeNosniff=true
      - traefik.http.middlewares.n8n.headers.forceSTSHeader=true
      - traefik.http.middlewares.n8n.headers.SSLHost=${DOMAIN_NAME}
      - traefik.http.middlewares.n8n.headers.STSIncludeSubdomains=true
      - traefik.http.middlewares.n8n.headers.STSPreload=true
      - traefik.http.routers.n8n.middlewares=n8n@docker
    environment:
      - NO_PROXY=localhost,127.0.0.1
      - N8N_HOST=${SUBDOMAIN}.${DOMAIN_NAME}
      - N8N_PORT=5678
      - N8N_PROTOCOL=https
      - NODE_ENV=production
      - WEBHOOK_URL=https://${SUBDOMAIN}.${DOMAIN_NAME}/
      - GENERIC_TIMEZONE=${GENERIC_TIMEZONE}
      - N8N_EDITOR_BASE_URL=https://${SUBDOMAIN}.${DOMAIN_NAME}/
      - N8N_LOG_LEVEL=debug
    restart: always
    volumes:
      - ./n8n_data:/home/node/.n8n
    networks:
      - traefik-network

Please share your workflow



изображение

Information on your n8n setup

  • n8n version: 1.60.1
  • Database (default: SQLite): SQLite
  • n8n EXECUTIONS_PROCESS setting (default: own, main): default
  • Running n8n via docker-compose with traefik from documentation
  • Operating system: Ubuntu

It looks like your topic is missing some important information. Could you provide the following if applicable.

  • n8n version:
  • Database (default: SQLite):
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • Running n8n via (Docker, npm, n8n cloud, desktop app):
  • Operating system:
1 Like

@Jon may you help me?) I’ve already tried everything I thought of myself or found here on the forum

Can anyone help?
any ideas would be great

Hey @Andrey_Khokhlov

It looks like everything is set up ok just don’t forget that the v1 and v2 APIs use different versions of oauth so you need to make sure you use the correct keys.

Looking at the error and the mention of a proxy I suspect Twitter has blocked the connection because of the domain or ip of the connection. It may be worth opening a support case with Twitter / X

I use different keys for v1 and v2.

I am confused that when integrating by V2, the first requests to Twitter go through normally → it returns a callback to my domain. But when n8n trying to write data from the callback, some magic happens.

Is there any other way to see the error? Because error which returns now is absolutely not informative.


MB i found problem - TLS | Docs | Twitter Developer Platform
I use self-signed certificates.

1 Like

@Jon nope, it’s does not work again(
I spent $40 for buying certificate, and nothing…

Hey @Andrey_Khokhlov,

I don’t think self signed certificates would cause the issue you are seeing as the application is saying it can’t connect.

Are you trying to access Twitter / X using a proxy and if so how are you setting it? We do have an issue where https connections over an http proxy will fail so you could be seeing that.

It could also be that the credential connection is trying to go direct and not going through any proxy, Which region is your n8n instance located in?

Are you trying to access Twitter / X using a proxy and if so how are you setting it?
I am used proxy on linux server for every requests. But i think it does not work for callback)

We do have an issue where https connections over an http proxy will fail so you could be seeing that.
First request to x.com work well. Callback from x break by TLS connection

It could also be that the credential connection is trying to go direct and not going through any proxy, Which region is your n8n instance located in?
RU region

Hey @Andrey_Khokhlov

This is a tricky one so it could be that the proxy isn’t working correctly for the oauth connection and the region is being blocked or the domain is blocked as Twitter / X like a lot of companies including ourselves are not allowed to provide services to Ru regions.

I would recommend reaching out to Twitter / X support to see if they can provide more information.

I spent one week and $60 for knowledge that n8n worst working with proxy. I tried to use all types and all ideas:

  • http/https on docker
  • http/https on n8n by environment variables
  • http/https on linux by root envs
  • socks on docker
  • socks on n8n by by environment variables
  • socks on linux by root envs

I did not try VPN, but i think that will not working with oauth because there are will be different ip addresses for request token and callback.

If someone take the same problem - buy VPS on free-blocking country. It will be cheaper and simplier.

изображение

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.