Discussions
Error Packaging Function. Please try again or contact support for assistance. Cannot save any changes to simple function.
26 days ago by Nick Stephens
I have only just had this error happen to me when saving a simple function. Was working ok up until a few days ago. Any one have any idea how to recify? Its just a copy of the Hello world from github. Did work fine
see code below.
'use strict';
//var request = require("request");
exports.handler = (event,context,callback) => {
console.log('Received event:', JSON.stringify(event, null, 2));
const strJobUUID = event.eventArgs.jobUUID;
const strJobNumber = getJobData(event);
displayPage(event,callback,strJobNumber);
};
function getJobData(event){
const options = {
method: 'GET',
headers: {
accept: 'application/json',
authorization: 'Basic bmljay5zdGVwaGVuc0B2bG1hdXMuY29tLmF1OjBmMTM3NWQxLTJhNzQtNDczOC1iMjUxLTIyNmZlZDU3YzgyYg=='
}
};
return "Oi";
}
function displayPage(event,callback,strJobNumber){
const strHTML = `
<html>
<head>
<link rel="stylesheet" href="https://platform.servicem8.com/sdk/1.0/sdk.css">
<script src="https://platform.servicem8.com/sdk/1.0/sdk.js"></script>
<script>
var client = SMClient.init();
//Resize Addon Window
client.resizeWindow(500, 200);
</script>
</head>
<body>
<h1>Hello World Lambda Event</h1>
<p>You have opened job <b>` + event.eventArgs.jobUUID + `</b></p>
<p>Hope this displays job number (data for the moment) <b>` + strJobNumber + `</b></p>
<button onClick="client.closeWindow();">Close Window</button>
</body>
</html>
`;
// callback is what data is returned from the function
callback(null,
{
eventResponse: strHTML
}
);
}
Any ideas would be unreal.