Yourls node works with an error

Hi!

If checked separately on just one Yourls node, it seems to work fine.
But if I use this node in the workflow, I get the error “URL already exists in database”.

Describe the issue/error/question

ERROR: Bad request - please check your parameters
https://docs.google.com/spreadsheets/d/1HCNrhoHzjP5yh[...] already exists in database (short URL: 1.1144.ru/20) although no such URL exists in the database Yourls

What is the error message (if any)?

{"message":"400 - {\"status\":\"fail\",\"code\":\"error:url\",\"message\":\"https://docs.google.com/spreadsheets/d/1HCNrho6wH5yh[...] already exists in database (short URL: 1.1144.ru/20)\",\"errorCode\":\"400\",\"statusCode\":\"400\",\"url\":{\"keyword\":\"20\",\"url\":\"https://docs.google.com/spreadsheets/d/1HCNpaLXfr9pDyOy9w28j8/edit#gid=1902344499\",\"title\":\"Ошибки публикации в zzap - Google Таблицы\",\"date\":\"2022-09-07 19:36:48\",\"ip\":\"17\",\"clicks\":\"0\"},\"title\":\"Ошибки публикации в zzap - Google Таблицы\",\"shorturl\":\"http://144.ru/20\"}","name":"Error","stack":"Error: Request failed with status code 400\n    at createError (/usr/local/lib/node_modules/n8n/node_modules/axios/lib/core/createError.js:16:15)\n    at settle (/usr/local/lib/node_modules/n8n/node_modules/axios/lib/core/settle.js:17:12)\n    at IncomingMessage.handleStreamEnd (/usr/local/lib/node_modules/n8n/node_modules/axios/lib/adapters/http.js:269:11)\n    at IncomingMessage.emit (node:events:525:35)\n    at endReadableNT (node:internal/streams/readable:1358:12)\n    at processTicksAndRejections (node:internal/process/task_queues:83:21)"}

Please share the workflow

Information on your n8n setup

  • n8n version: 0.188.0
  • Database you’re using (default: SQLite): SQLite
  • Running n8n with the execution process [own(default), main]:
  • Running n8n via [Docker, npm, n8n.cloud, desktop app]: Docker

Hey @Mikhail,

That is a bit of an odd one, I am not sure why Yourls would say the link exists but for some reason it thinks it does.

Can you share the output data from the webhook node so we can take a proper look?

1 Like

Hi @Jon !
Thank you so much for such a quick response!

it’s from Webhook1 :

[
{
"headers": {
"host": "",
"user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/ Safari/537.36",
"accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9",
"accept-encoding": "gzip, deflate, br",
"accept-language": "en-US,en;q=0.9",
"cookie": "n8n-auth=eyJhbGciOiJIUzI1N6IkpXVCJ9.eyJpZCI6ImNkMTAxNGZhLTIwMmItNGQ3MC04YjFhLTUzZGE5ZmE4YjJjoibWlraGFpbC5rYXBAbWFpbC5ydSIsInBhc3N3b3JkIjoiY2FmNGJlZTBiMWI4MTVhZmMxOTBiMmJlN2I1ZTU4NzZkMjIzOGIyOTZjZmRjMTIwYmFlNDZhY2FiOTNkMmQwNyIsImlhdCI6MTY2MjU3NjMwMiwiZXhwIjoxNjYzMTgxMTAyfQ.t87JO-W_xVcKon_cTVBpjeuBFTqwyO7YxosR0pa67C0",
"dnt": "1",
"sec-ch-ua": "" Not A;Brand";v="99", "Chromium";v="102"",
"sec-ch-ua-mobile": "?0",
"sec-ch-ua-platform": ""Windows"",
"sec-fetch-dest": "document",
"sec-fetch-mode": "navigate",
"sec-fetch-site": "none",
"sec-fetch-user": "?1",
"upgrade-insecure-requests": "1",
"x-forwarded-for": "",
"x-forwarded-host": "",
"x-forwarded-port": "443",
"x-forwarded-proto": "https",
"x-forwarded-server": "3f22a30370",
"x-real-ip": ""
},
"params": {
},
"query": {
"text": "206587"
},
"body": {
}
}
]

@Jon I can also send you access to Yourls admin if needed

Hey @Mikhail,

Is it meant to always shorten the URL of the Google Sheet?

Hey @Jon

No, here is the correct workflow:


Hey @Mikhail,

When you get the error is the Google Sheet node only outputting one item?

@Jon yes, that’s right - 1 item .

Hey @Mikhail,

It might be worth contacting Yourls to see if they know why they are saying the url already exists. I can’t see anything wrong from our side.

Okay, I’ll write and I’ll write back here as soon as I get an answer.

1 Like

Hey @Jon !

While they are answering my question, I wanted to ask about the Respond to Webhook node:

If there are Cyrillic characters in the link - the workflow gives an error: Bad Gateway

the link:

https://docs.google.com/forms/d/e/1FAIpQLe4YWCMeMTwi8GuEP_RDMlZsTBJfhE25Q/viewform?usp=pp_url&entry.122621695=105424&entry.1246242845=Облицовка%20Audi%20A8%20(D4)%20III%20рестайлинг%20(2013–2018)&entry.308542603=250

Is there any way to resolve this issue so that everything works correctly?
Thank you!

Does the same redirect work with other urls ok? The url itself seems to be ok so I am not sure why it would be throwing a gateway timeout.

All links of this kind with Cyrillic characters or russian words like “Облицовка”, “рестайлинг”, etc will not work in that workflow. But they work on their own if you manually insert them into the browser or click on them.

This happens precisely because they have Cyrillic characters.

I thought there was a way in n8n that works in a similar way as in a browser,
when you manually copy or paste something, it converts ( punycode-converter ) all the links.

For example, here’s a website:

https://объясняем.рф

and if you go to it and copy the link address from your browser, you get this:

https://xn--90aivcdt6dxbc.xn--p1ai/

It is the same address, just Cyrillic characters converted to Latin.

Hey @Mikhail,

You are not using a full domain with cyrillic characters though so a full conversion likely wouldn’t be needed like that. Instead what you would need to do is encode the URI so that it can be understood so the URL you have would go from…

https://docs.google.com/forms/d/e/1FAIpQLSfh005B4KhktaUllQe4YWCMeMTwi8GuEP_RDMlZsTBJfhE25Q/viewform?usp=pp_url&entry.122621695=105424&entry.1246242845=Облицовка Audiv A8 (D4) III рестайлинг (2013–2018)&entry.308542603=250

to

https://docs.google.com/forms/d/e/1FAIpQLSfh005B4KhktaUllQe4YWCMeMTwi8GuEP_RDMlZsTBJfhE25Q/viewform?usp=pp_url&entry.122621695=105424&entry.1246242845=%D0%9E%D0%B1%D0%BB%D0%B8%D1%86%D0%BE%D0%B2%D0%BA%D0%B0%20Audiv%20A8%20(D4)%20III%20%D1%80%D0%B5%D1%81%D1%82%D0%B0%D0%B9%D0%BB%D0%B8%D0%BD%D0%B3%20(2013%E2%80%932018)&entry.308542603=250

You can do this using the workflow below which is working in the testing I have done using your form url.

1 Like

Yes, everything works perfectly. :+1: Now I don’t need the Yourls node.

While I was digging through the documentation, the forum, and most likely found what the error could be(sort of):

In config.php - must stand false here:
/** Allow multiple short URLs for a same long URL
** Set to true to have only one pair of shortURL/longURL (default YOURLS behavior)
** Set to false to allow multiple short URLs pointing to the same long URL (bit.ly behavior) */
define( ‘YOURLS_UNIQUE_URLS’, false );

Thank you so much for your help and time! :slightly_smiling_face:

1 Like