careerfairsystems / nexpo-backend

0 stars 1 forks source link

Update company #88

Open mu1664al-s opened 3 years ago

mu1664al-s commented 3 years ago

When trying to update a company as admin, the fallowing error is generated at the backend and it fails.

[error] Ranch protocol #PID<0.506.0> of listener Nexpo.Endpoint.HTTP (cowboy_protocol) terminated
** (exit) an exception was raised:
    ** (FunctionClauseError) no function clause matching in :cow_uri.urldecode/2
        (cowboy 1.1.2) /workspace/deps/cowboy/src/cow_uri.erl:26: :cow_uri.urldecode("[object%20Object]", "")
        (cowboy 1.1.2) /workspace/deps/cowboy/src/cowboy_router.erl:331: :cowboy_router."-split_path/2-lc$^1/1-1-"/1
        (cowboy 1.1.2) /workspace/deps/cowboy/src/cowboy_router.erl:331: :cowboy_router.split_path/2
        (cowboy 1.1.2) /workspace/deps/cowboy/src/cowboy_router.erl:334: :cowboy_router.split_path/2
        (cowboy 1.1.2) /workspace/deps/cowboy/src/cowboy_router.erl:271: :cowboy_router.match_path/4
        (cowboy 1.1.2) /workspace/deps/cowboy/src/cowboy_router.erl:169: :cowboy_router.execute/2
        (cowboy 1.1.2) /workspace/deps/cowboy/src/cowboy_protocol.erl:442: :cowboy_protocol.execute/4
[error] Process #PID<0.506.0> raised an exception
** (FunctionClauseError) no function clause matching in :cow_uri.urldecode/2
    (cowboy 1.1.2) /workspace/deps/cowboy/src/cow_uri.erl:26: :cow_uri.urldecode("[object%20Object]", "")
    (cowboy 1.1.2) /workspace/deps/cowboy/src/cowboy_router.erl:331: :cowboy_router."-split_path/2-lc$^1/1-1-"/1
    (cowboy 1.1.2) /workspace/deps/cowboy/src/cowboy_router.erl:331: :cowboy_router.split_path/2
    (cowboy 1.1.2) /workspace/deps/cowboy/src/cowboy_router.erl:334: :cowboy_router.split_path/2
    (cowboy 1.1.2) /workspace/deps/cowboy/src/cowboy_router.erl:271: :cowboy_router.match_path/4
    (cowboy 1.1.2) /workspace/deps/cowboy/src/cowboy_router.erl:169: :cowboy_router.execute/2
    (cowboy 1.1.2) /workspace/deps/cowboy/src/cowboy_protocol.erl:442: :cowboy_protocol.execute/4

On client side.

Proxy error: Could not proxy request /api/companies/[object%20Object] from localhost:3000 to http://127.0.0.1:4000.
See https://nodejs.org/api/errors.html#errors_common_system_errors for more information (ECONNRESET).
emarforio commented 3 years ago

I think I know what causes this, I will insvestigate more but I suspect that it is the frontend that does not serialize the company id in the url correctly and therefore the backend is not able to parse it.

mu1664al-s commented 3 years ago

I think I know what causes this, I will insvestigate more but I suspect that it is the frontend that does not serialize the company id in the url correctly and therefore the backend is not able to parse it.

I have fixed it. There are just two tests failing but I know why. You are right about the frontend but there was also a major issue in backend. It seems like the ability for admin to change the profile image was added later. There was no proper endpoint to handle it and the controller that should work couldn't handle multipart form data.