#Are there any know issues with the "aws-lambda" preset?

25 messages · Page 1 of 1 (latest)

viral lily
#

I 'am currently migrating an SPA with SSR to @tanstack/start. The app is deployed on AWS Lambda, so I was wondering if there are any known issues because of the warning.

mint glade
#

You mean the untested warning yes?

#

We haven't had the time to test it out or even check whether it works at all.

#

We just wanted to cover our bases.

viral lily
#

Ok, thnx. I will give an update here about the migration.

mint glade
#

Cool beans.

#

If its working, could probably take it out of the untested list.

viral lily
#

@mint glade As far as I can seen now, the only thing that is not working are server functions. Somehow the files from .vinxi/build/server/_server/*.mjs are not bundled into the .output folder.

viral lily
#

If I look in runtime.mjs, server function code has been embedded, but a request from the client tries to resolve c_oku6zv.mjs and cannot find it.

const mod_0_3 = /#PURE/ Object.freeze({
proto: null,
$$function0: y,
Route: F,
getCountryCode: f,
});

const chunks = {};
chunks["c_oku6zv.mjs"] = mod_0_3;

viral lily
#

My post build step (workaround) is now cp .vinxi/build/server/_server/*.mjs .output/server/chunks/build, but this will fail if there are name clashes.

#

Wouldn't it be better if the output folder has seperate folders for client and server artifacts, i.e. use different base folders in the output for each router? (Don't know if this a @tanstack/start, vinxi or nitro issue)

mint glade
# viral lily Wouldn't it be better if the output folder has seperate folders for client and s...

That's a good point. Generally, this should resolve if its working on the other deployment presets, so I'd look into Vinxi and Nitro. Perhaps, see if you are able to take one of their server-functions examples and see if that can be deployed?

I'll unfortunately not be able to look into this for a couple weeks at the least. Sorry for the late response 😅.
Not to mention AWS deactivate my account over a year ago and absolutely do not budge to opening closed accounts 🤷🏼‍♂️

viral lily
#

I discovered the issue and is was caching. CloudFront responded with an older page that used an older serverFnId. The workaround above is not needed at all.

viral lily
lusty light
#

please check the e2e test failure

viral lily
#

I don't think it is a problem with the fix. The errors we get are "net::ERR_CONNECTION_REFUSED " errors. When I run the tests in the failed package they succeed. Also when I run nx run-many --target=test:e2e --parallel=false all test succeed. But when I run nx run-many --target=test:e2e, we get the "net::ERR_CONNECTION_REFUSED " errors.

lusty light
#

I retriggered the build job, let's wait

viral lily
#

Two weeks ago we went live with @tanstack/start and the aws-lambda preset. So far everything looks good.

lusty light
#

can you share the site?

viral lily
lime quiver
#

I am currently evaluating start using the aws-lambda preset too. While I managed to deploy to cloudfront and lambda exposed via API Gateway with AWS cdk successfully I struggle to understand how to wire up the connection to the lambda server side. @viral lily do you have a hint how you managed to connect these pieces?

viral lily
#

@lime quiver We take the lambda code from the folder produced by nitro .output/server in the CDK like this:

    const code = Code.fromAsset(
        path.join(
            '.output',
            'server',
        ),
        {
            followSymlinks: SymlinkFollowMode.ALWAYS,
        },
    );

We deploy the files/folders from .output/public to S3 and create behaviours for the folders and files in CloudFront. The default behaviour points to an apigateway that proxies everything to the lambda.

I hope this helps

lime quiver
#

@viral lily thanks this already helps. Is it possible to give a small example snippet for the behaviours in cloudfront? Thanks!

viral lily
lime quiver
#

Thanks, will check this