Search code examples
motoko

My canister doesn't launch, trying to read the docs about buffer & the tutorial


I'm doing the motokobootcamp.com chapter 1 and trying this simple code, the canister doesn't run on Gitpod.

import Buffer "mo:base/Buffer";
actor {

    let name : Text = "deFiSport";
    var manifesto : Text = "deFiSport is  a DAO that rules few canisters & dApps allowing young sportsmen & sportwomen to earn money thanks to their performances, image & more."
    let goals : Buffer.Buffer = Buffer.Buffer<Text>(0);

    public shared query func getName() : async Text {
        return name;
    };

    public shared query func getManifesto() : async Text {
        return manifesto;
    };

    public func setManifesto(newManifesto : Text) : async () {
        manifesto := newManifesto;
        return;
    };

    public func addGoal(newGoal : Text) : async () {
        goals.add(newGoal);
        return;
    };

    public shared query func getGoals() : async [Text] {
       return Buffer.toArray(goals);
    };
};

I tried to :

  • Copy-Paste the solution, it doesn't work

  • Watching the tutorial

  • Read the docs, especially about Buffer

This is what returns the terminal. First terminal image Second terminal image

-------------------------- Edit --------------------------

The problem was a semi-column that I missed to the variable manifesto.

The thing is now a new error occured. New error


Solution

  • I see that this line does not end with a semicolon.

    var manifesto : Text = "deFiSport is a DAO that rules few canisters & dApps allowing young sportsmen & sportwomen to earn money thanks to their performances, image & more."

    Also

    Verify your github access is working. Check ability to: login to github; access files on github from your local machine (e.g. git clone). if you haven't done so, "Create GitHub SSH keys"

    Another path: Setup a local motoko build environment and build without deploy. https://internetcomputer.org/docs/current/developer-docs/getting-started/install/#installing-dfx-via-dfxvm

    Once you have a solution that builds, test it in the "Motoko Playground - DFINITY" by creating a project there and copy/paste your source code. Build the canister there. Submit your cansister id as per the assignment.