wixLocation url and query parameters not working

Hi, I am trying to pass parameters from one page to another on my site, and I am having trouble getting the parameters from the url using the “wixLocation.query”. When I use the query I get “Undefined”. I also tried just printing the url, but the “query” part of the url does not show. Please help!
I am using the following code:
Button Page (where I pass the variable to the next page on button click):

wixLocation.to("/sweater?keys=thisThing");//Navigation to second page and pass variables to call on sweater page	

“sweater” Page (where I use a query to get the url parameters):

$w.onReady(function () {
    let url = wixLocation.url;
    let query = wixLocation.query; // {"species": "african-elephant"}
    console.log("this is wixlocation query")
    let answer = query.keys;

I get an “answer = Undefined” and only my site’s baseURL prints for the console.log(url). My site is published.
Any ideas?