r12543
Getting UndefinedFunctionError for a variable, even after it is well defined
Hello,
I am getting the following error. Code is also mentioned below.
%UndefinedFunctionError{arity: 0, function: :offset, message: nil, module: nil, reason: nil}
{offset, _} = Integer.parse(headers["upload-offset"]). # headers["upload-offset"] returns a valid result everytime. "0", "452342" etc
upload_info = UploadCache.get(identifier)
if offset != upload_info.offset do. # here it crashes and throw the error.
... # doing something here
else
This does not happen every time. I found this issue in the production sometimes and I am not even able to reproduce this on my local machine. Can anyone give their inputs in what scenarios, this type of error can occur?
Stack trace
msg:Ranch listener OkApi.Router.HTTP, connection process #PID<0.19205.307>, stream 3 had its request process #PID<0.18116.307> exit with reason {{%UndefinedFunctionError{arity: 0, function: :offset, message: nil, module: nil, reason: nil},
[{nil, :offset,
[],
[]}, {ExTus.Actions, :patch, 3,
[file: 'lib/actions.ex', line: 81]}, {OkApi.TusRouter, :"-do_match/4-fun-7-", 2,
[file: 'lib/routers/tus_router.ex', line: 25]}, {OkApi.TusRouter, :dispatch, 2,
[file: 'lib/plug/router.ex', line: 284]}, {OkApi.TusRouter, :plug_builder_call, 2,
[file: 'lib/routers/tus_router.ex', line: 1]}, {Plug, :forward, 4,
[file: 'lib/plug.ex', line: 168]}, {OkApi.Router, :dispatch, 2,
[file: 'lib/plug/router.ex', line: 284]}, {OkApi.Router, :plug_builder_call, 2,
[file: 'lib/Router.ex', line: 1]}]}, {OkApi.Router, :call,
[%Plug.Conn{adapter: {Plug.Cowboy.Conn, :...}, assigns: %{}, before_send:
[], body_params: %Plug.Conn.Unfetched{aspect: :body_params}, cookies: %Plug.Conn.Unfetched{aspect: :cookies}, halted: false, host: "<some-host>", method: "PATCH", owner: #PID<0.18116.307>, params: %Plug.Conn.Unfetched{aspect: :params}, path_info:
["files", "<identifier>"], path_params: %{}, port: 80, private: %{}, query_params: %Plug.Conn.Unfetched{aspect: :query_params}, query_string: "", remote_ip: {..., .., ., ...}, req_cookies: %Plug.Conn.Unfetched{aspect: :cookies}, req_headers:
h=[
{"accept-encoding", "gzip"},
{"authorization", "<jwt_token>"},
{"connection", "keep-alive"},
{"content-type", "application/offset+octet-stream"},
{"host", "<some-host>.com"},
{"migration_ver", "2"},
{"newrelic", "...."},
{"traceparent", "..."},
{"tracestate", ",..."},
{"tus-resumable", "1.0.0"},
{"upload-metadata", "filename Y2JiMjA2OTgtZGNmYy00MTgwLWE3M2MtYzYxMGZjOTg5YWE5Lm1wNA=="},
{"upload-offset", "0"},
{"user-agent", "Dalvik/2.1.0 (Linux; U; Android 9; CPH2083 Build/PPR1.180610.011)"},
{"user_id", "....."},
{"x-forwarded-for", "....."},
{"x-forwarded-port", "443"},
{"x-forwarded-proto", "https"},
{"x-newrelic-id", "....."}
], request_path: "/files/<identifier>", resp_body: nil, resp_cookies: %{}, resp_headers:
[{"cache-control", "max-age=0, private, must-revalidate"}], scheme: :http, script_name:
[], secret_key_base: nil, state: :unset, status: nil},
[]]}} and stacktrace
[]
This is an open source function, here is the link extus/lib/actions.ex at 273f8b15588743787ca8a9abcb9d815ee2c9f8ae · bluzky/extus · GitHub
Thanks
Marked As Solved
michallepicki
Last Post!
r12543
AAAHH…that might be it. Thanks a lot, I was thinking that the offset variable is causing the issue. Let me check that. Thanks again.
0
Popular in Questions
Hi everyone!
I need implement if…else if…else condition from my elixir code, and anymore of this control flow structures not work proper...
New
If I have a post route which an argument:
post /my_post_route/:my_param1, MyController.my_post_handler
How would get the post params ...
New
Hello everyone,
I try to use an Javascript Event Handler in my root.html.leex file.
Therefore I created a function in the app.js file: ...
New
I’ve got an issue with an app and I’ve no idea of how to troubleshoot it. I’m hoping someone here might have seen something similar.
I p...
New
After calling mix ecto.create I get this error:
17:00:32.162 [error] GenServer #PID<0.412.0> terminating
** (Postgrex.Error) FATAL...
New
I have a server on AWS, and was running a load test using artillery. When looking at the Phoenix dashboard I see the Ports going to 100% ...
New
In the code below, if the create action is not set to accept “extra_key” as an input, it errors out with a message shown above. Is there ...
New
Other popular topics
Hi guys, i’m new in the Elixir world, and i have to say, that i love it!
i’m having some problem to understand anonymous functions with ...
New
Hi All,
I set a environment variables in dev.exs , like below code.
when i start server, how can i set the ${enable} value?
thanks.
d...
New
Surface is an experimental library built on top of Phoenix LiveView and its new LiveComponent API that aims to provide a more declarative...
New
i’m a new one to elixir
which editor can i use
vs code? or atom?
Thanks! :smiley:
New
I am trying to run a deploy with docker and I successfully runned with this command:
docker build -t romenigld/blog-prod .
but when I t...
New
In the code below, if the create action is not set to accept “extra_key” as an input, it errors out with a message shown above. Is there ...
New
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #channels
- #elixirconf
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #phoenix_html
- #iex
- #blog-post
- #graphql
- #genstage
- #ai
- #websockets
- #supervisor
- #elixirconf-us
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #metaprogramming
- #security
- #hex









