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

runtime compile error with deno-lambda example #232

Open
cknight opened this issue Apr 24, 2023 · 0 comments
Open

runtime compile error with deno-lambda example #232

cknight opened this issue Apr 24, 2023 · 0 comments

Comments

@cknight
Copy link

cknight commented Apr 24, 2023

I've followed the SAR quick-start guide in the repo and deployed the deno layer. I've then created a new function from scratch, chosen custom runtime and added the deno layer as per the instructions. I've uploaded the latest code (deno-lambda-example.zip v1.32.5) to the function. However when I run a test for the first time I get the following error:

Response
{
  "errorMessage": "unable to compile hello.ts",
  "errorType": "InitException"
}

Function Logs
error: Module not found "file:///var/runtime/mod.ts".
at file:///var/task/hello.ts:5:8
error: unable to compile hello.ts
error: Module not found "file:///var/runtime/mod.ts".
at file:///var/task/hello.ts:5:8
error: unable to compile hello.ts
START RequestId: 170ee5c6-39c3-45d5-b469-9571a14a936e Version: $LATEST
Unknown application error occurred
Runtime.Unknown
END RequestId: 170ee5c6-39c3-45d5-b469-9571a14a936e

The import it is failing on is this code (unmodified from the zip file):

import {
  APIGatewayProxyEventV2,
  APIGatewayProxyResultV2,
  Context,
} from "../runtime/mod.ts";

Looking at the code in the repo and examining the zip files, there is no mod.ts file at the root of deno-lambda-example.zip (which would be uploaded to /var/runtime I believe).

Looking at the generation of the zip files, it would appear that mod.ts should be referenced by it's full URL (https://deno.land/x/lambda/mod.ts) and retrieved from the deno cache in .deno-dir. Thus, if I update the import in hello.ts to:

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

I get it to work, but with a slow init/cold start as it is downloading the dependencies from scratch rather than using the cached copies in the .deno-dir directory included in the deno-lambda-example.zip. Output from this change:

Function Logs
Download https://deno.land/x/lambda/mod.ts
Warning Implicitly using latest version (1.32.5) for https://deno.land/x/lambda/mod.ts
Download https://deno.land/x/lambda@1.32.5/mod.ts
Download https://deno.land/x/lambda@1.32.5/types.d.ts
START RequestId: 3a401818-3eb4-46c5-944e-c0cae35c773b Version: $LATEST
END RequestId: 3a401818-3eb4-46c5-944e-c0cae35c773b
REPORT RequestId: 3a401818-3eb4-46c5-944e-c0cae35c773b	Duration: 57.32 ms	Billed Duration: 1281 ms	Memory Size: 128 MB	Max Memory Used: 86 MB	Init Duration: 1222.95 ms

Where am I going wrong? Why isn't the .deno-dir cache being used? Any help most appreciated.

@cknight cknight changed the title runtime compile error with deno-lambda runtime compile error with deno-lambda example Apr 24, 2023
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