upstash / issues

Issue Tracker for Upstash
https://upstash.com
2 stars 0 forks source link

Issue with Netlify edge function #36

Closed tipiirai closed 1 year ago

tipiirai commented 1 year ago

I'm following the instructions on your blog entry, but when I run the edge function locally using netlify dev I get the following error on the console:

TypeError: func.function is not a function
    at https://637cf7ce9214b300099b3aa8--edge.netlify.app/bootstrap/function_chain.ts:299:28
    at https://637cf7ce9214b300099b3aa8--edge.netlify.app/bootstrap/util/named_wrapper.ts:19:24
    at nf_req_f0c64611-05e5-4044-8ab7-4c719727b81b (https://637cf7ce9214b300099b3aa8--edge.netlify.app/bootstrap/util/named_wrapper.ts:12:68)
    at callWithNamedWrapper (https://637cf7ce9214b300099b3aa8--edge.netlify.app/bootstrap/util/named_wrapper.ts:19:10)
    at FunctionChain.runFunction (https://637cf7ce9214b300099b3aa8--edge.netlify.app/bootstrap/function_chain.ts:298:30)
    at FunctionChain.run (https://637cf7ce9214b300099b3aa8--edge.netlify.app/bootstrap/function_chain.ts:251:33)
    at handleRequest (https://637cf7ce9214b300099b3aa8--edge.netlify.app/bootstrap/handler.ts:59:34)
    at Server.<anonymous> (https://637cf7ce9214b300099b3aa8--edge.netlify.app/bootstrap/server.ts:29:23)
    at Server.#respond (https://deno.land/std@0.136.0/http/server.ts:298:37)
    at Server.#serveHttp (https://deno.land/std@0.136.0/http/server.ts:340:20)

What could be the problem?

Thank you!

tipiirai commented 1 year ago

Ignore the above. It was a misconfiguration on my end. I managed to get things working with the fetch command. However I get an authorization error when using the Redis import:

import { Redis } from "https://deno.land/x/upstash_redis@v1.3.2/mod.ts";
const redis = new Redis({
  url: 'https://global-becoming-goat-yyyy.upstash.io',
  token: 'AX7sACQgOTExY2MyOTAtO....'
})

// this throws "Unauthorized"
await redis.set('foo', 'bar')

Even when I use the same URL and token than with the fetch command.

tipiirai commented 1 year ago

I got the above working as well. The token was pasted wrongly. Sorry for the ramble!!