https://www.boundaryml.com logo
For refence here is the docker to build
# questions
z
For refence here is the docker to build the layer and runtime along with the bash script and how the runner calls the code
Copy code
FROM amazonlinux:2023

RUN dnf update -y && \
    dnf install -y tar gzip xz zip nodejs npm

ENV NODE_VERSION=22.2.0

RUN curl -O https://nodejs.org/dist/v$NODE_VERSION/node-v$NODE_VERSION-linux-x64.tar.xz && \
    tar -xf node-v$NODE_VERSION-linux-x64.tar.xz && \
    mkdir -p /layer/nodejs && \
    cp -r node-v$NODE_VERSION-linux-x64/* /layer/nodejs/

WORKDIR /app
COPY . .
RUN cd types && /layer/nodejs/bin/npm install
RUN /layer/nodejs/bin/npm install

RUN /layer/nodejs/bin/npm run build && \
    cp ./dist/index.js /layer/nodejs/runner.js

# Custom bootstrap script
COPY ./bootstrap /layer/bootstrap
RUN chmod +x /layer/bootstrap

RUN /layer/nodejs/bin/npm install --prefix /layer/nodejs @boundaryml/baml

# Final ZIP layer
RUN cd /layer && zip -r /layer/node22-layer.zip .
bootstrap
Copy code
#!/bin/sh

export NODE_PATH="/opt/nodejs/node_modules:$NODE_PATH"
exec /opt/nodejs/bin/node /opt/nodejs/runner.js
How runner imports script
Copy code
const runner = await import(root + handler);
if (typeof runner.default !== 'function') {
    throw new Error('Handler must export a default function');
}
const response = await runner.default(request);
v
This is likely a great @aaronv (BAML) or @seawatts question!
Did you update your generator to the esm version btw?
j
ah thanks, ok I see this error and i commented elsewhere but already worked through it > The BAML syntax is incorrect - colons should be spaces. Let me fix it:
could absolutely be my issue so don't look into it
... unless you already know about it
what tools are people using to capture context from discord? the easiest way i know for like anywhere is just taking screen shots and processing them to text in one way or another and then context
and last question for now: are there any windows or macos or linux specific issues?
not sure... but I will, testing docker still but have to fix things on the windows computer i haven't used much
z
I do generate esm but I’ve tried cjs also.
Has AL2023 resolved the nodejs gyp bindings or whatever it was blocking release? I assume so if you're using it on purpose.
v
whast AL2023?
z
@Vaibhav (BAML 🐑) AL2023 is amazon linux. Not to sure what @jensbodal is working on but I am trying to add it to a custom lambda runtime i created but got a weird runtime error event though it was added to the node_modules.
@Vaibhav (BAML 🐑) here is the exact error. "errorMessage": "Cannot find package '@boundaryml/baml' imported from /var/task/build/index.js\nDid you mean to import \"@boundaryml/baml/index.js\"?",
a
Try importing from what it says there
Or change module_format “esm” in the generator
z
@aaronv (BAML) that’s not from my code that’s from the generated code and I tried both outputs. It runs locally but fails on AWS.
a
ok thanks, i think we just need to test it out in Lambda using fargate containers -- thats your setup correct?
j
AL issues are often related to pre-compiled linked library versions in the kernel; I spent too much time getting playwright/puppeteer working in lambda - if you haven’t focused there I would do that or feel free to share more info @zedgell - I have a repo somewhere with my AL2 chrome driver lambda experimentations but there are much better examples on github - The issue you’re having though sounds like a lambda specific issue most likely. I am already making the mistake of guessing what it is without knowing. What size container are you using? Default lambda is very small - lambda layers can help but I would get it working without them first if you are already using them. Make sure to at least start with 1792 RAM (max free tier specs - or if cost isn’t a problem just use a better one to rule it out) and check metrics. I’ve had issues with tmp folders and post install magic and things that only happened in lambda - etc I can’t find the docs but initial glance of https://docs.aws.amazon.com/lambda/latest/dg/snapstart.html mentions some limitations and relating info on the managed runtimes (SnapStart is not relevant to your issue - the article just has some technical details of how lambda runtime works) 1792 RAM or is (was?) the maximum performance you can get out of free tier - if you can share more details I can probably help