Giter VIP home page Giter VIP logo

start-aws's People

Contributors

corvusprudens avatar diversable avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

start-aws's Issues

Routes being generated for Lambda deployment

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!

Update README to use this template

There's a small issue with the README.md in its current form - following the instructions uses the generic Leptos Axum starter template instead of this repo.

Update the repo instructions to ensure users clone this repo instead.

The readme should use:
cargo generate --git https://github.com/leptos-rs/start-aws.git

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.