I write to the disk some temporary files (“/app/priv/static/upload_images” for completeness) which Phoenix normally serves. However, sometimes Fly can’t display the (thumbnail) image (the source references a file in this private static folder). The picture is also the inner content of a link which opens another version of this image. Sometimes this link doesn’t work either. Sometimes I need several retries to eventually display it. This behaviour seems related to the “freshness” of the build, meaning It don’t get any errors after a few minutes.
When I peak into this folder with an IEx session, I can see the temporary files, most of the time: indeed, sometimes when I list the folder, it appears empty even if some files are displayed, and sometimes, it is the opposite, I see files that have been pruned. The good point is that this seems to calm down after a few minutes and Fly is able to let Phoenix serve them properly. The error message is below. After having spent time trying to find out what I did wrong, I believe it is not on my side. Is this a caching problem? or internal routing?
NB: I did not set a volume nor anything mentioned in the static section nor file section of the docs.
Request: GET /image_uploads/resized-Screenshot2023-09-19at154739.webp
2023-09-22T11:56:05Z app[4d89661c5e1e28] cdg [info]** (exit) an exception was raised:
2023-09-22T11:56:05Z app[4d89661c5e1e28] cdg [info] ** (KeyError) key :current_user not found in: %{
2023-09-22T11:56:05Z app[4d89661c5e1e28] cdg [info] reason: %Phoenix.Router.NoRouteError{
2023-09-22T11:56:05Z app[4d89661c5e1e28] cdg [info] plug_status: 404,
2023-09-22T11:56:05Z app[4d89661c5e1e28] cdg [info] message: "no route found for GET /image_uploads/resized-Screenshot2023-09-19at154739.webp (UpImgWeb.Router)",
...
stack: [
2023-09-22T11:56:05Z app[4d89661c5e1e28] cdg [info] {UpImgWeb.Router, :call, 2,
2023-09-22T11:56:05Z app[4d89661c5e1e28] cdg [info] [file: ~c"deps/phoenix/lib/phoenix/router.ex", line: 487]},
2023-09-22T11:56:05Z app[4d89661c5e1e28] cdg [info] {UpImgWeb.Endpoint, :plug_builder_call, 2,
2023-09-22T11:56:05Z app[4d89661c5e1e28] cdg [info] [file: ~c"lib/up_img_web/endpoint.ex", line: 1]},
2023-09-22T11:56:05Z app[4d89661c5e1e28] cdg [info] {UpImgWeb.Endpoint, :call, 2,
2023-09-22T11:56:05Z app[4d89661c5e1e28] cdg [info] [file: ~c"lib/up_img_web/endpoint.ex", line: 1]},
2023-09-22T11:56:05Z app[4d89661c5e1e28] cdg [info] {Plug.Cowboy.Handler, :init, 2,
2023-09-22T11:56:05Z app[4d89661c5e1e28] cdg [info] [file: ~c"lib/plug/cowboy/handler.ex", line: 11]},
2023-09-22T11:56:05Z app[4d89661c5e1e28] cdg [info] {:cowboy_handler, :execute, 2,
2023-09-22T11:56:05Z app[4d89661c5e1e28] cdg [info] [file: ~c"/app/deps/cowboy/src/cowboy_handler.erl", line: 37]},
2023-09-22T11:56:05Z app[4d89661c5e1e28] cdg [info] {:cowboy_stream_h, :execute, 3,
2023-09-22T11:56:05Z app[4d89661c5e1e28] cdg [info] [file: ~c"/app/deps/cowboy/src/cowboy_stream_h.erl", line: 306]},
2023-09-22T11:56:05Z app[4d89661c5e1e28] cdg [info] {:cowboy_stream_h, :request_process, 3,
2023-09-22T11:56:05Z app[4d89661c5e1e28] cdg [info] [file: ~c"/app/deps/cowboy/src/cowboy_stream_h.erl", line: 295]},
2023-09-22T11:56:05Z app[4d89661c5e1e28] cdg [info] {:proc_lib, :init_p_do_apply, 3, [file: ~c"proc_lib.erl", line: 241]}
2023-09-22T11:56:05Z app[4d89661c5e1e28] cdg [info] ],