The script you posted works.
This is the initial script that gave me an error.
`const { app } = require("photoshop");
const width = app.activeDocument.width;
const height = app.activeDocument.height;
await app.activeDocument.resizeCanvas(width + 200, height + 200);
`
What I don't understand is why if I restart the script from file/scripts/browse it works, but if I do it with your panel it gives me an error?