Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issues Bundling #28

Closed
khrome83 opened this issue May 20, 2020 · 1 comment
Closed

Issues Bundling #28

khrome83 opened this issue May 20, 2020 · 1 comment

Comments

@khrome83
Copy link
Contributor

Is there anything that prevents vercel dev from bundling the contents?

Every time I run a lambda, I have no issues. But when I try to manually bundle it, or run vercel dev I get this.

error: Uncaught AssertionError: Assertion failed.
    at Object.assert ($deno$/util.ts:33:11)
    at compile ($deno$/compiler.ts:1355:5)
    at async tsCompilerOnMessage ($deno$/compiler.ts:1548:22)
    at async workerMessageRecvCallback ($deno$/runtime_worker.ts:74:9)

So now I am not sure of the issue. If I remove mustache, it works. I had issues with multiple things that I am importing. I am not saying the vanilla code is an issue. I am trying to understand why it's so fragile, and what these libraries are using that can be bundled outside of now-deno, but in combination with now-deno just fail.

vercel.dev

{
  "version": 2,
  "functions": {
    "api/**/*.{j,t}s": {
      "runtime": "now-deno@0.4.0",
      "includeFiles": "**/*.html"
    }
  },
  "env": {
    "DENO_UNSTABLE": "true"
  }
}

api/test/index.ts

import {
  APIGatewayProxyEvent,
  APIGatewayProxyResult,
  Context,
} from "https://deno.land/x/lambda/mod.ts";
import { renderFile } from "https://deno.land/x/mustache/mod.ts";

export async function handler(
  event: APIGatewayProxyEvent,
  context: Context
): Promise<APIGatewayProxyResult> {
  return {
    statusCode: 200,
    body: await renderFile(`template.html`, {
      txt: "HEY",
    }),
    headers: {
      "content-type": "text/html; charset=utf-8",
    },
  };
}

api/test/template.html

<p>Hello {{ txt }}</p>
@khrome83
Copy link
Contributor Author

Closing this issue, because I feel like Deno was not available in my path. It was not until recently when i tried to install a script that I realized it was missing, even though I had the command.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant