The "Could not find symbol 'require'" in the Azure portal script editor is just a bug in how that environment validates the script - it shouldn't affect the actual operation of the service itself. See Phillip Van Nortwick's reply in the Azure forums.
It's likely that your InvalidOperationException is coming from other error. Have you tried calling an api with thise require()s defined and otherwise empty code?