-
Notifications
You must be signed in to change notification settings - Fork 6
Description
Hi there!
I have been using leptos
for a personal project at Amazon, trying at the same time to get a better grasp of Web development in Rust. So far, local development has been great, loved having cargo-leptos
for hot-reloading and more.
Once I had something quick locally (just a main page), wanted to move to deploy it in a Lambda, and I was able to do so, by using cargo-leptos
and cargo-lambda
with the example start-aws
. No issue there. The question comes around understanding what are the routes being defined when deployed this way.
When running cargo leptos watch
, my localhost on the main path shows the HomePage and I would expect it to be the same way when deploying to Lambda. To avoid the XY Problem:
I have a Route53 domain connected to an API Gateway that connects to the Lambda I deployed with my Leptos code base. When contacting the Route53 domain (also tested the API Gateway directly), I see that the Lambda is invoked, but it returns an 404 page.
<script type="module">
function idle(c) {
if ("requestIdleCallback" in window) {
window.requestIdleCallback(c);
} else {
c();
}
}
idle(() => {
import('/pkg/amzn-gota-a-gota.js')
.then(mod => {
mod.default('/pkg/amzn-gota-a-gota.wasm').then(() => mod.hydrate());
})
});
</script>
</head><body><!--hk=0-0-0-4--><!--hk=0-0-0-6--><!--hk=0-0-0-8--><!--hk=0-0-0-9--><main data-hk="0-0-0-12"><h1 data-hk="0-0-0-18">Error</h1><h2 data-hk="0-0-0-21">404 Not Found</h2><p data-hk="0-0-0-22">Error: Not Found</p><!--hk=0-0-0-20--><!--hk=0-0-0-23--><!--hk=0-0-0-19--><!--hk=0-0-0-17--><!--hk=0-0-0-16--><!--hk=0-0-0-15--><!--hk=0-0-0-13--></main><!--hk=0-0-0-11--><!--hk=0-0-0-10--><!--hk=0-0-0-2--><!--hk=0-0-0-1--><script>__LEPTOS_PENDING_RESOURCES = [];__LEPTOS_RESOLVED_RESOURCES = new Map();__LEPTOS_RESOURCE_RESOLVERS = new Map();__LEPTOS_LOCAL_ONLY = [];</script></body></html>
Following that set up, I thought that Leptos would set up the "" route to be pointing to the HomePage (haven't modified that, it's part of the start-aws
example), hence the connection directly with a GET
method to the root method would return that page.
Any guidance / pointers? I'll keep investigating whether the API Gateway is changing the method to contact the Lambda.
Have a duplicate discussion on the main repo, but I thought cross-posting here where probably @CorvusPrudens could help might be more productive! leptos-rs/leptos#2159
Thanks so much!