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

Error posting to job_files api when job_key can be parsed as a number #15211

Closed
cat-bro opened this issue Dec 14, 2022 · 1 comment
Closed

Error posting to job_files api when job_key can be parsed as a number #15211

cat-bro opened this issue Dec 14, 2022 · 1 comment
Assignees
Milestone

Comments

@cat-bro
Copy link
Contributor

cat-bro commented Dec 14, 2022

Describe the bug
I noticed this in Galaxy Australia's logs:

galaxy.web.framework.decorators ERROR 2022-12-14 02:16:45,618 [pN:main.3,p:437938,tN:WSGI_0] Uncaught exception in exposed API method:
Traceback (most recent call last):
  File "/mnt/galaxy/galaxy-app/lib/galaxy/web/framework/decorators.py", line 337, in decorator
    rval = func(self, trans, *args, **kwargs)
  File "/mnt/galaxy/galaxy-app/lib/galaxy/webapps/galaxy/api/job_files.py", line 85, in create
    job = self.__authorize_job_access(trans, job_id, **payload)
  File "/mnt/galaxy/galaxy-app/lib/galaxy/webapps/galaxy/api/job_files.py", line 125, in __authorize_job_access
    if not util.safe_str_cmp(kwargs["job_key"], job_key):
  File "/mnt/galaxy/galaxy-app/lib/galaxy/util/__init__.py", line 1615, in safe_str_cmp
    if len(a) != len(b):
TypeError: object of type 'int' has no len()
uvicorn.access INFO 2022-12-14 02:16:45,619 [pN:main.3,p:437938,tN:MainThread] 115.146.85.19:0 - "POST /api/jobs/c15ee125c1617b92/files?job_id=c15ee125c1617b92&job_key=3316341265241993&path=/mnt/tmp/job_working_directory/005/169/5169098/metadata/__instrument_env_vars&file_type=output_metadata HTTP/1.0" 500

The vast majority of posts to this endpoint are fine. I think the problem with this one is that the hexadecimal job_key is made up entirely of numbers and is stored in kwargs as an int rather than a string.

Galaxy Version and/or server at which you observed the bug
usegalaxy.org.au
Galaxy Version: 22.05
Commit: f2c221f

@mvdbeek
Copy link
Member

mvdbeek commented Dec 14, 2022

yikes, I think as quick fix you can cast these to strings, but we should prioritize converting this over to FastAPI which doesn't have these issues.

@mvdbeek mvdbeek added this to the 23.0 milestone Jan 10, 2023
@mvdbeek mvdbeek self-assigned this Jan 10, 2023
mvdbeek added a commit to mvdbeek/galaxy that referenced this issue Feb 14, 2023
@dannon dannon closed this as completed Feb 14, 2023
cat-bro pushed a commit to cat-bro/galaxy that referenced this issue Mar 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants