Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RestAPI link now fails with a 500 Error #972

Closed
cwldev opened this issue Jan 21, 2021 · 2 comments · Fixed by #973
Closed

RestAPI link now fails with a 500 Error #972

cwldev opened this issue Jan 21, 2021 · 2 comments · Fixed by #973
Labels
Milestone

Comments

@cwldev
Copy link

cwldev commented Jan 21, 2021

How Shlink is set-up

  • Shlink Version: Server: v2.5.0 - Client: latest
  • shlinkio/shlink:stable docker container. sha256:a4f773d5dd590ebed5c5d0097d77c99f4f7495b9042a282c70cde5db81909037
  • PHP Version: whatever version is in the container
  • How do you serve Shlink: Self-Hosted Docker image
  • Database engine used: MariaDB
  • Additionally - a nginx container points to shlink internally proxy_pass http://domainname.com:8080/; this continues to work redirecting links.

Summary

Everything from the web interface, to link redirects, works fine. I've updated through numerous docker images without major issues. On the most recent update, I've noticed the creation of links via the rest API such as:

https://domainname.com/rest/v2/short-urls/shorten?apiKey=xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxx&longUrl=https%3A%2F%2Fwww.google.com%2F&format=txt

Current behavior

The link fails, the browser says: ERR_INVALID_RESPONSE

On the back-end (shlink container docker logs), I see the errors:
Access.ERROR - 192.168.1.181 - - "GET /rest/v2/short-urls/shorten?apiKey=xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxx&longUrl=https%3A%2F%2Fwww.google.com%2F&format=txt HTTP/1.1" 500 201
Shlink.ERROR - TypeError: Return value of Shlinkio\Shlink\Rest\Middleware\AuthenticationMiddleware::apiKeyFromRequest() must be an instance of Shlinkio\Shlink\Rest\Entity\ApiKey, null returned in /etc/shlink/module/Rest/src/Middleware/AuthenticationMiddleware.php:62
.. stack track follows. I can provide the full details if requested.

From the nginx container - that points internally to the shlink (running on port 8080) container:
curl -Is http://domainname.com:8080 | head -n 1
HTTP/1.1 404 Not Found

shlink-web continues to operate completely and normally.

Expected behavior

The above has always returned short link in the browser in simple text format:
http://domainname.com/cZSv6

How to reproduce

Not sure at this point, All I've been doing is updating docker images from a working installation.

Not sure if part of this API was decommissioned or if something broke here. Maybe I should expect more of it to break.

@cwldev cwldev added the bug label Jan 21, 2021
@acelaya
Copy link
Member

acelaya commented Jan 21, 2021

Hey, thanks for reporting.

This is a regression on v2.5.0, not the intended behavior.

I'll get it fixed for v2.5.1

@acelaya acelaya added this to the 2.5.1 milestone Jan 21, 2021
@acelaya
Copy link
Member

acelaya commented Jan 21, 2021

I have just released v2.5.1 including a fix for this.

The docker image will be available once this build finishes https://github.com/shlinkio/shlink/runs/1744187099?check_suite_focus=true, which will be in about 1h, as the build generates multi-arch images, which makes it slower.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants