vercel-community / deno

🦕 Deno runtime for ▲ Vercel Serverless Functions

Home Page:https://vercel-deno.vercel.app

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

TypeError: ref.startsWith is not a function

christianhaller3000 opened this issue · comments

Hi Nathan,
thanks for your cool deno runtime. It feels super futuristic to use it with vercel. ❤️
In vercel-deno@0.3.2 my deployment fails.
When I use vercel-deno@0.3.0, it's okay.

Bildschirmfoto 2020-07-01 um 21 39 53

The problem might be located here:
https://github.com/TooTallNate/vercel-deno/blob/201cd4e45e8d3eb4be789327f6c14939c8405b4c/src/index.ts#L177

Shoot! Would you be able to share with me the code that is failing?

Thanks for helping me.
I will provide the failing example in 7 hours

Vercel CLI 19.1.1 Error! Resource is limited - try again after in 7 hours (more than 100, code: "api-deployments-free-builds-per-day").

I guess that importing a local module just let it fail.

// request.ts
const request = async (url: URL) => {
  return "abc";
};
export { request };
import { ServerRequest } from "https://deno.land/std@0.58.0/http/server.ts";
import { request} from "./request"; // if I don't import request, it works.


export default async (req: ServerRequest) => {
  req.respond({ body:"i love deno" });
};

Running your code as shown above fails because "./request" needs the .ts file extension (source):

error: Cannot resolve module "file:///vercel/10c672d9/api/request" from "file:///vercel/10c672d9/api/test.ts"

Fixing that, the API endpoint works as expected (source).

So basically, I can't seem to reproduce this so far. Could you perhaps share a full GH repo that demonstrates the issue?

Feel free to share any Vercel deployment URLs with me as well, I can take a closer look.

You were completely right Nathan!
The correct deno import syntax with .ts was helping me.
Thank you for your patience and sorry for the trouble :)

Glad you figured it out! Still strange to me that I couldn't reproduce your original error, but if things are working fine for you now then I'm not gonna worry about it for now.