Error on line 5:30: ReferenceError: Cannot access uninitialized variable

I’m trying to create a widget that reads a json file from a url.
My browser can read the json file no problem.
I’m trying to get this example to work in scriptable but I receive the error message in the subject.

I’m guessing it thinks the variable “url” is not defined but it appears to be defined. Am I missing something obvious?

** // const url = "";
const url = "";

async function getData(url){
    let request = new Request(url);
	data = await request.loadJSON();
	return data;

function processData(data){
	// Process your data here
	// ...
	return processedData;

function createWidget(data){
	var widget = new ListWidget();
	var text = widget.addText(data.sample);
	text.textColor = Color.dynamic(, Color.white);
	text.font = Font.regularRoundedSystemFont(13);

	widget.backgroundColor = Color.dynamic(Color.white,;

	return widget;

let data = await getData(url);
let processedData = processData(data);
let widget = await createWidget(processedData);

data = await request.loadJSON();

The variable data is not declared. Put a const or let in front of it.

I can’t believe I missed that.
I was looking at the wrong line from the error message but still.
Thanks for taking the time to point it out