Skip to content

(CaseClauseError) no case clause matching: :ok #34

@daniloraisi

Description

@daniloraisi

I am using SRH to test locally an implementation using Upstash Redis, but I can't make it work.

A brief context: I'm running a serverless function on Supabase Edge Functions (this is working locally using Docker).

The code is written in Typescript using Deno. I omitted some code for simplicity.

Deno.serve(async (_req) => {
  const redis = new Redis({
    url: Deno.env.get("UPSTASH_REDIS_REST_URL"),
    token: Deno.env.get("UPSTASH_REDIS_REST_TOKEN"),
  });

  // (...) omitted code

  for (const mention of mentions) {
    const exists = await redis.exists(mention.cid);
    
    if (exists) {
      continue;
    }
    
    // (...) omitted code

    await redis.set(target.cid, "reposted");
  }

  return new Response({ message: "Processing done" }, {
    headers: { "Content-Type": "application/json" },
  });
});

My docker-compose.yml is configured like the instructions on the README.

services:
  redis:
    image: redis:latest
    ports:
      - "6379:6379"
  serverless-redis-http:
    ports:
      - "8079:80"
    image: hiett/serverless-redis-http:latest
    env_file: .env
    environment:
      SRH_MODE: env
      SRH_TOKEN: ${UPSTASH_REDIS_REST_TOKEN}
      SRH_CONNECTION_STRIN: redis://redis:6379

When trying to connect using the Redis client, I'm getting this Elixir error on SRH Container

serverless-redis-http-1  | 17:40:27.032 [error] #PID<0.1119.0> running Srh.Http.BaseRouter (connection #PID<0.1118.0>, stream id 1) terminated
serverless-redis-http-1  | Server: host.docker.internal:8079 (http)
serverless-redis-http-1  | Request: POST /pipeline
serverless-redis-http-1  | ** (exit) an exception was raised:
serverless-redis-http-1  |     ** (CaseClauseError) no case clause matching: :ok
serverless-redis-http-1  |         (srh 0.1.0) lib/srh/http/command_handler.ex:178: Srh.Http.CommandHandler.dispatch_command/2
serverless-redis-http-1  |         (srh 0.1.0) lib/srh/http/command_handler.ex:72: Srh.Http.CommandHandler.dispatch_command_array/3
serverless-redis-http-1  |         (srh 0.1.0) lib/srh/http/base_router.ex:39: Srh.Http.BaseRouter.do_command_request/2
serverless-redis-http-1  |         (srh 0.1.0) lib/plug/router.ex:246: anonymous fn/4 in Srh.Http.BaseRouter.dispatch/2
serverless-redis-http-1  |         (telemetry 1.1.0) /app/deps/telemetry/src/telemetry.erl:320: :telemetry.span/3
serverless-redis-http-1  |         (srh 0.1.0) lib/plug/router.ex:242: Srh.Http.BaseRouter.dispatch/2
serverless-redis-http-1  |         (srh 0.1.0) lib/srh/http/base_router.ex:1: Srh.Http.BaseRouter.plug_builder_call/2
serverless-redis-http-1  |         (plug_cowboy 2.5.2) lib/plug/cowboy/handler.ex:12: Plug.Cowboy.Handler.init/2

A note about the log: it is pointing to host.docker.internal because my Serverless Function is running on a separated network.

Any thoughts?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions