API_LEVEL non compliance details ... anything to worry about? - android-management-api

We recently adopted the Android Management API and we've got around 250 kiosk devices which are in various locations throughout the UK.
I can see a bunch of warnings related to the API level of the device.
i.e policyCompliant: true, however there are some nonComplianceDetails.
I'm wondering if this is something to worry about? Will the devices factory reset themselves after a certain amount of time?
An affected device
{
"name": "enterprises/XXXXXXXX/devices/XXXXXXXX",
"managementMode": "DEVICE_OWNER",
"state": "ACTIVE",
"appliedState": "ACTIVE",
"policyCompliant": true,
"nonComplianceDetails": [
{
"settingName": "systemErrorDialogsDisabled",
"nonComplianceReason": "API_LEVEL"
},
{
"settingName": "lockTaskFeatures",
"nonComplianceReason": "API_LEVEL"
}
],
"enrollmentTime": "2019-01-25T17:09:08.693Z",
"lastStatusReportTime": "2019-12-02T11:15:14.869Z",
"lastPolicySyncTime": "2019-12-02T11:15:10.501Z",
"appliedPolicyVersion": "4",
"apiLevel": 24,
"enrollmentTokenData": "20",
"disabledReason": {},
"hardwareInfo": {
"brand": "XXXX",
"hardware": "XXXXXX",
"deviceBasebandVersion": "XXXXXXXX",
"manufacturer": "XXXX",
"serialNumber": "XXXXXXXX",
"model": "XXXXXX"
},
"policyName": "enterprises/XXXXXXXX/policies/policy_v41",
"appliedPolicyName": "enterprises/XXXXXXXX/policies/policy_v41",
"networkInfo": {
"imei": "XXXXXXXX",
"wifiMacAddress": "38:1c:4a:XX:c2:XX",
"networkOperatorName": "vodafone UK"
},
"memoryInfo": {
"totalRam": "1008689152",
"totalInternalStorage": "1560133632"
},
"userName": "enterprises/XXXXXXXX/users/XXXXXXXX",
"enrollmentTokenName": "enterprises/XXXXXXXX/enrollmentTokens/XXXXXXXX",
"securityPosture": {
"devicePosture": "POTENTIALLY_COMPROMISED",
"postureDetails": [
{
"securityRisk": "COMPROMISED_OS",
"advice": [
{
"defaultMessage": "The user should restore their device to a clean factory ROM."
}
]
}
]
}
}
Corresponding policy
{
"name": "enterprises/XXXXXXXX/policies/policy_v41",
"applications": [
{
"packageName": "com.example.examplekiosk",
"installType": "FORCE_INSTALLED",
"lockTaskAllowed": true,
"defaultPermissionPolicy": "GRANT",
"minimumVersionCode": 41
}
],
"screenCaptureDisabled": true,
"cameraDisabled": true,
"defaultPermissionPolicy": "GRANT",
"persistentPreferredActivities": [
{
"receiverActivity": "com.example.examplekiosk/.activities.splash.SplashActivity",
"actions": [
"android.intent.action.MAIN"
],
"categories": [
"android.intent.category.HOME",
"android.intent.category.DEFAULT"
]
}
],
"systemUpdate": {
"type": "AUTOMATIC"
},
"addUserDisabled": true,
"factoryResetDisabled": true,
"mountPhysicalMediaDisabled": true,
"modifyAccountsDisabled": true,
"safeBootDisabled": true,
"uninstallAppsDisabled": true,
"statusBarDisabled": true,
"keyguardDisabled": true,
"statusReportingSettings": {
"networkInfoEnabled": true
},
"wifiConfigsLockdownEnabled": true,
"cellBroadcastsConfigDisabled": true,
"credentialsConfigDisabled": true,
"tetheringConfigDisabled": true,
"vpnConfigDisabled": true,
"createWindowsDisabled": true,
"networkResetDisabled": true,
"outgoingBeamDisabled": true,
"outgoingCallsDisabled": true,
"removeUserDisabled": true,
"smsDisabled": true,
"unmuteMicrophoneDisabled": true,
"usbFileTransferDisabled": true,
"ensureVerifyAppsEnabled": true,
"stayOnPluggedModes": [
"AC"
],
"setUserIconDisabled": true,
"setWallpaperDisabled": true,
"dataRoamingDisabled": true,
"locationMode": "HIGH_ACCURACY",
"funDisabled": true,
"autoTimeRequired": true,
"appAutoUpdatePolicy": "ALWAYS",
"encryptionPolicy": "ENABLED_WITHOUT_PASSWORD",
"playStoreMode": "WHITELIST",
"policyEnforcementRules": [
{
"settingName": "passwordPolicies",
"blockAction": {
"blockAfterDays": 299
},
"wipeAction": {
"wipeAfterDays": 300
}
},
{
"settingName": "encryptionPolicy",
"blockAction": {
"blockAfterDays": 299
},
"wipeAction": {
"wipeAfterDays": 300
}
},
{
"settingName": "keyguardDisabled",
"blockAction": {
"blockAfterDays": 299
},
"wipeAction": {
"wipeAfterDays": 300
}
},
{
"settingName": "permittedInputMethods",
"blockAction": {
"blockAfterDays": 299
},
"wipeAction": {
"wipeAfterDays": 300
}
},
{
"settingName": "permittedAccessibilityServices",
"blockAction": {
"blockAfterDays": 299
},
"wipeAction": {
"wipeAfterDays": 300
}
},
{
"settingName": "applications",
"blockAction": {
"blockAfterDays": 299
},
"wipeAction": {
"wipeAfterDays": 300
}
},
{
"settingName": "maximumTimeToLock",
"blockAction": {
"blockAfterDays": 299
},
"wipeAction": {
"wipeAfterDays": 300
}
},
{
"settingName": "screenCaptureDisabled",
"blockAction": {
"blockAfterDays": 299
},
"wipeAction": {
"wipeAfterDays": 300
}
},
{
"settingName": "cameraDisabled",
"blockAction": {
"blockAfterDays": 299
},
"wipeAction": {
"wipeAfterDays": 300
}
},
{
"settingName": "keyguardDisabledFeatures",
"blockAction": {
"blockAfterDays": 299
},
"wipeAction": {
"wipeAfterDays": 300
}
},
{
"settingName": "defaultPermissionPolicy",
"blockAction": {
"blockAfterDays": 299
},
"wipeAction": {
"wipeAfterDays": 300
}
},
{
"settingName": "persistentPreferredActivities",
"blockAction": {
"blockAfterDays": 299
},
"wipeAction": {
"wipeAfterDays": 300
}
},
{
"settingName": "openNetworkConfiguration",
"blockAction": {
"blockAfterDays": 299
},
"wipeAction": {
"wipeAfterDays": 300
}
},
{
"settingName": "systemUpdate",
"blockAction": {
"blockAfterDays": 299
},
"wipeAction": {
"wipeAfterDays": 300
}
},
{
"settingName": "accountTypesWithManagementDisabled",
"blockAction": {
"blockAfterDays": 299
},
"wipeAction": {
"wipeAfterDays": 300
}
},
{
"settingName": "addUserDisabled",
"blockAction": {
"blockAfterDays": 299
},
"wipeAction": {
"wipeAfterDays": 300
}
},
{
"settingName": "adjustVolumeDisabled",
"blockAction": {
"blockAfterDays": 299
},
"wipeAction": {
"wipeAfterDays": 300
}
},
{
"settingName": "factoryResetDisabled",
"blockAction": {
"blockAfterDays": 299
},
"wipeAction": {
"wipeAfterDays": 300
}
},
{
"settingName": "installAppsDisabled",
"blockAction": {
"blockAfterDays": 299
},
"wipeAction": {
"wipeAfterDays": 300
}
},
{
"settingName": "mountPhysicalMediaDisabled",
"blockAction": {
"blockAfterDays": 299
},
"wipeAction": {
"wipeAfterDays": 300
}
},
{
"settingName": "modifyAccountsDisabled",
"blockAction": {
"blockAfterDays": 299
},
"wipeAction": {
"wipeAfterDays": 300
}
},
{
"settingName": "safeBootDisabled",
"blockAction": {
"blockAfterDays": 299
},
"wipeAction": {
"wipeAfterDays": 300
}
},
{
"settingName": "uninstallAppsDisabled",
"blockAction": {
"blockAfterDays": 299
},
"wipeAction": {
"wipeAfterDays": 300
}
},
{
"settingName": "statusBarDisabled",
"blockAction": {
"blockAfterDays": 299
},
"wipeAction": {
"wipeAfterDays": 300
}
},
{
"settingName": "keyguardDisabled",
"blockAction": {
"blockAfterDays": 299
},
"wipeAction": {
"wipeAfterDays": 300
}
},
{
"settingName": "minimumApiLevel",
"blockAction": {
"blockAfterDays": 299
},
"wipeAction": {
"wipeAfterDays": 300
}
},
{
"settingName": "statusReportingSettings",
"blockAction": {
"blockAfterDays": 299
},
"wipeAction": {
"wipeAfterDays": 300
}
},
{
"settingName": "bluetoothContactSharingDisabled",
"blockAction": {
"blockAfterDays": 299
},
"wipeAction": {
"wipeAfterDays": 300
}
},
{
"settingName": "shortSupportMessage",
"blockAction": {
"blockAfterDays": 299
},
"wipeAction": {
"wipeAfterDays": 300
}
},
{
"settingName": "longSupportMessage",
"blockAction": {
"blockAfterDays": 299
},
"wipeAction": {
"wipeAfterDays": 300
}
},
{
"settingName": "passwordRequirements",
"blockAction": {
"blockAfterDays": 299
},
"wipeAction": {
"wipeAfterDays": 300
}
},
{
"settingName": "wifiConfigsLockdownEnabled",
"blockAction": {
"blockAfterDays": 299
},
"wipeAction": {
"wipeAfterDays": 300
}
},
{
"settingName": "bluetoothConfigDisabled",
"blockAction": {
"blockAfterDays": 299
},
"wipeAction": {
"wipeAfterDays": 300
}
},
{
"settingName": "cellBroadcastsConfigDisabled",
"blockAction": {
"blockAfterDays": 299
},
"wipeAction": {
"wipeAfterDays": 300
}
},
{
"settingName": "credentialsConfigDisabled",
"blockAction": {
"blockAfterDays": 299
},
"wipeAction": {
"wipeAfterDays": 300
}
},
{
"settingName": "mobileNetworksConfigDisabled",
"blockAction": {
"blockAfterDays": 299
},
"wipeAction": {
"wipeAfterDays": 300
}
},
{
"settingName": "tetheringConfigDisabled",
"blockAction": {
"blockAfterDays": 299
},
"wipeAction": {
"wipeAfterDays": 300
}
},
{
"settingName": "vpnConfigDisabled",
"blockAction": {
"blockAfterDays": 299
},
"wipeAction": {
"wipeAfterDays": 300
}
},
{
"settingName": "wifiConfigDisabled",
"blockAction": {
"blockAfterDays": 299
},
"wipeAction": {
"wipeAfterDays": 300
}
},
{
"settingName": "createWindowsDisabled",
"blockAction": {
"blockAfterDays": 299
},
"wipeAction": {
"wipeAfterDays": 300
}
},
{
"settingName": "networkResetDisabled",
"blockAction": {
"blockAfterDays": 299
},
"wipeAction": {
"wipeAfterDays": 300
}
},
{
"settingName": "outgoingBeamDisabled",
"blockAction": {
"blockAfterDays": 299
},
"wipeAction": {
"wipeAfterDays": 300
}
},
{
"settingName": "outgoingCallsDisabled",
"blockAction": {
"blockAfterDays": 299
},
"wipeAction": {
"wipeAfterDays": 300
}
},
{
"settingName": "removeUserDisabled",
"blockAction": {
"blockAfterDays": 299
},
"wipeAction": {
"wipeAfterDays": 300
}
},
{
"settingName": "shareLocationDisabled",
"blockAction": {
"blockAfterDays": 299
},
"wipeAction": {
"wipeAfterDays": 300
}
},
{
"settingName": "smsDisabled",
"blockAction": {
"blockAfterDays": 299
},
"wipeAction": {
"wipeAfterDays": 300
}
},
{
"settingName": "unmuteMicrophoneDisabled",
"blockAction": {
"blockAfterDays": 299
},
"wipeAction": {
"wipeAfterDays": 300
}
},
{
"settingName": "usbFileTransferDisabled",
"blockAction": {
"blockAfterDays": 299
},
"wipeAction": {
"wipeAfterDays": 300
}
},
{
"settingName": "ensureVerifyAppsEnabled",
"blockAction": {
"blockAfterDays": 299
},
"wipeAction": {
"wipeAfterDays": 300
}
},
{
"settingName": "permittedInputMethods",
"blockAction": {
"blockAfterDays": 299
},
"wipeAction": {
"wipeAfterDays": 300
}
},
{
"settingName": "stayOnPluggedModes",
"blockAction": {
"blockAfterDays": 299
},
"wipeAction": {
"wipeAfterDays": 300
}
},
{
"settingName": "recommendedGlobalProxy",
"blockAction": {
"blockAfterDays": 299
},
"wipeAction": {
"wipeAfterDays": 300
}
},
{
"settingName": "setUserIconDisabled",
"blockAction": {
"blockAfterDays": 299
},
"wipeAction": {
"wipeAfterDays": 300
}
},
{
"settingName": "setWallpaperDisabled",
"blockAction": {
"blockAfterDays": 299
},
"wipeAction": {
"wipeAfterDays": 300
}
},
{
"settingName": "choosePrivateKeyRules",
"blockAction": {
"blockAfterDays": 299
},
"wipeAction": {
"wipeAfterDays": 300
}
},
{
"settingName": "alwaysOnVpnPackage",
"blockAction": {
"blockAfterDays": 299
},
"wipeAction": {
"wipeAfterDays": 300
}
},
{
"settingName": "frpAdminEmails",
"blockAction": {
"blockAfterDays": 299
},
"wipeAction": {
"wipeAfterDays": 300
}
},
{
"settingName": "deviceOwnerLockScreenInfo",
"blockAction": {
"blockAfterDays": 299
},
"wipeAction": {
"wipeAfterDays": 300
}
},
{
"settingName": "dataRoamingDisabled",
"blockAction": {
"blockAfterDays": 299
},
"wipeAction": {
"wipeAfterDays": 300
}
},
{
"settingName": "locationMode",
"blockAction": {
"blockAfterDays": 299
},
"wipeAction": {
"wipeAfterDays": 300
}
},
{
"settingName": "networkEscapeHatchEnabled",
"blockAction": {
"blockAfterDays": 299
},
"wipeAction": {
"wipeAfterDays": 300
}
},
{
"settingName": "bluetoothDisabled",
"blockAction": {
"blockAfterDays": 299
},
"wipeAction": {
"wipeAfterDays": 300
}
},
{
"settingName": "blockApplicationsEnabled",
"blockAction": {
"blockAfterDays": 299
},
"wipeAction": {
"wipeAfterDays": 300
}
},
{
"settingName": "installUnknownSourcesAllowed",
"blockAction": {
"blockAfterDays": 299
},
"wipeAction": {
"wipeAfterDays": 300
}
},
{
"settingName": "debuggingFeaturesAllowed",
"blockAction": {
"blockAfterDays": 299
},
"wipeAction": {
"wipeAfterDays": 300
}
},
{
"settingName": "funDisabled",
"blockAction": {
"blockAfterDays": 299
},
"wipeAction": {
"wipeAfterDays": 300
}
},
{
"settingName": "autoTimeRequired",
"blockAction": {
"blockAfterDays": 299
},
"wipeAction": {
"wipeAfterDays": 300
}
},
{
"settingName": "permittedAccessibilityServices",
"blockAction": {
"blockAfterDays": 299
},
"wipeAction": {
"wipeAfterDays": 300
}
},
{
"settingName": "appAutoUpdatePolicy",
"blockAction": {
"blockAfterDays": 299
},
"wipeAction": {
"wipeAfterDays": 300
}
},
{
"settingName": "kioskCustomLauncherEnabled",
"blockAction": {
"blockAfterDays": 299
},
"wipeAction": {
"wipeAfterDays": 300
}
},
{
"settingName": "skipFirstUseHintsEnabled",
"blockAction": {
"blockAfterDays": 299
},
"wipeAction": {
"wipeAfterDays": 300
}
},
{
"settingName": "privateKeySelectionEnabled",
"blockAction": {
"blockAfterDays": 299
},
"wipeAction": {
"wipeAfterDays": 300
}
},
{
"settingName": "encryptionPolicy",
"blockAction": {
"blockAfterDays": 299
},
"wipeAction": {
"wipeAfterDays": 300
}
},
{
"settingName": "usbMassStorageEnabled",
"blockAction": {
"blockAfterDays": 299
},
"wipeAction": {
"wipeAfterDays": 300
}
},
{
"settingName": "permissionGrants",
"blockAction": {
"blockAfterDays": 299
},
"wipeAction": {
"wipeAfterDays": 300
}
},
{
"settingName": "playStoreMode",
"blockAction": {
"blockAfterDays": 299
},
"wipeAction": {
"wipeAfterDays": 300
}
},
{
"settingName": "setupActions",
"blockAction": {
"blockAfterDays": 299
},
"wipeAction": {
"wipeAfterDays": 300
}
},
{
"settingName": "passwordPolicies",
"blockAction": {
"blockAfterDays": 299
},
"wipeAction": {
"wipeAfterDays": 300
}
},
{
"settingName": "policyEnforcementRules",
"blockAction": {
"blockAfterDays": 299
},
"wipeAction": {
"wipeAfterDays": 300
}
}
]
}

API_LEVEL errors could be ignored in this case.
Few more suggestions:
1. Try enabling all status reporting policies for your device to have an extended view of the remote device.
For the "policyEnforcementRules" - you could try removing all values actually.
This one is probably for overriding overall default, this one is not supported.
{
"settingName": "policyEnforcementRules",
"blockAction": {
"blockAfterDays": 299
},
"wipeAction": {
"wipeAfterDays": 300
}
}

Updating my policy to the new Google recommended way of managing kiosk devices, i.e:
"applications": [
{
"packageName": "com.example.examplekiosk",
"installType": "KIOSK",
"defaultPermissionPolicy": "GRANT",
"minimumVersionCode": 41
}
],
Seems to have resolved the issue on the first handful devices that have been given the updated policy. So fingers crossed this completely resolves this issue.
I wish there was a migration guide or something to help when the recommended way to do something changes.

Related

Laravel 5.5 echo unable to listen to channel

I am currently using laravel-echo along with with pusher to set up my channel and broadcast however there seems to be some issues creating the listener onto the channel.
There should be a message on the pusher dashboard indicating that the channel is being listened to when the page is entered but nothing is being displayed
Initializing Echo Listener
$(document).ready(function() {
try{
window.Echo.channel('chat-room')
.listen('scannedQR', (e) => {
console.log("event has been triggered");
alert('event has been triggered');
});
alert('success');
}
catch(e){
console.log(e);
alert(e);
}
}
Bootstrap
import Echo from 'laravel-echo'
window.Pusher = require('pusher-js');
window.Lover = "LOVER!";
window.Echo = new Echo({
broadcaster: 'pusher',
key: 'key',
// cluster: 'mt1',
cluster:'ap1',
encrypted: true
});
Echo Object -> console.log(JSON.safeStringify(window.Echo));
{
"options": {
"broadcaster": "pusher",
"key": key,
"cluster": cluster,
"encrypted": true
},
"connector": {
"_defaultOptions": {
"auth": {
"headers": {
"X-CSRF-TOKEN": "oIywz9kkxhVbl109qOqXMy0NVrUCR5AZlYR5apPc"
}
},
"authEndpoint": "/broadcasting/auth",
"userAuthentication": {
"endpoint": "/broadcasting/user-auth",
"headers": {
"X-CSRF-TOKEN": "oIywz9kkxhVbl109qOqXMy0NVrUCR5AZlYR5apPc"
}
},
"broadcaster": "pusher",
"csrfToken": null,
"host": null,
"key": key,
"namespace": "App.Events",
"cluster": "ap1",
"encrypted": true
},
"pusher": {
"key": key,
"config": {
"activityTimeout": 120000,
"cluster": "ap1",
"httpPath": "/pusher",
"httpPort": 80,
"httpsPort": 443,
"pongTimeout": 30000,
"statsHost": "stats.pusher.com",
"unavailableTimeout": 10000,
"wsPath": "",
"wsPort": 80,
"wssPort": 443,
"enableStats": false,
"httpHost": "sockjs-ap1.pusher.com",
"useTLS": true,
"wsHost": "ws-ap1.pusher.com"
},
"channels": {
"channels": {}
},
"global_emitter": {
"callbacks": {
"_callbacks": {}
},
"global_callbacks": []
},
"sessionID": 299457458,
"timeline": {
"key": key,
"session": 299457458,
"events": [
{
"instances": 1,
"timestamp": 1660358957487
},
{
"state": "connecting",
"timestamp": 1660358957538
},
{
"cached": true,
"transport": "xhr_streaming",
"latency": 410,
"timestamp": 1660358957539
},
{
"cid": 1,
"transport": "xhr_streamings",
"timestamp": 1660358957539
},
{
"cid": 1,
"state": "initialized",
"timestamp": 1660358957539
},
{
"cid": 1,
"state": "connecting",
"timestamp": 1660358957541
},
{
"cid": 1,
"state": "open",
"timestamp": 1660358957974
},
{
"state": "connected",
"params": {
"socket_id": "17356.8786996"
},
"timestamp": 1660358957976
}
],
"options": {
"cluster": cluster,
"features": [
"ws"
],
"params": {},
"limit": 50,
"level": 6,
"version": "7.3.0"
},
"sent": 0,
"uniqueID": 1
},
"connection": {
"callbacks": {
"_callbacks": {
"_connected": [
{},
{}
],
"_message": [
{},
{}
],
"_connecting": [
{},
{}
],
"_disconnected": [
{},
{}
],
"_error": [
{}
]
}
},
"global_callbacks": [],
"state": "connected",
"connection": {
"callbacks": {
"_callbacks": {
"_tls_only": [
{}
],
"_refused": [
{}
],
"_backoff": [
{}
],
"_retry": [
{}
],
"_message": [
{}
],
"_ping": [
{}
],
"_activity": [
{}
],
"_error": [
{}
],
"_closed": [
{}
]
}
},
"global_callbacks": [],
"id": "17356.8786996",
"transport": {
"callbacks": {
"_callbacks": {
"_error": [
{}
],
"_closed": [
{},
{}
],
"_message": [
{}
],
"_activity": [
{}
]
}
},
"global_callbacks": [],
"hooks": {
"urls": {},
"handlesActivityChecks": false,
"supportsPing": true
},
"name": "xhr_streaming",
"priority": 1,
"key": key,
"options": {
"key": key,
"useTLS": true,
"hostNonTLS": "sockjs-ap1.pusher.com:80",
"hostTLS": "sockjs-ap1.pusher.com:443",
"httpPath": "/pusher"
},
"state": "open",
"id": 1,
"socket": {
"hooks": {},
"session": "428/90n18c0a",
"location": {
"base": base,
"queryString": "?protocol=7&client=js&version=7.3.0"
},
"readyState": 1,
"stream": {
"callbacks": {
"_callbacks": {
"_chunk": [
{}
],
"_finished": [
{}
],
"_buffer_too_long": [
{}
]
}
},
"global_callbacks": [],
"hooks": {},
"method": "POST",
"url": url,
"position": 2188,
"xhr": {}
}
}
}
},
"key": key,
"options": {
"activityTimeout": 120000,
"pongTimeout": 30000,
"unavailableTimeout": 10000,
"useTLS": true
},
"usingTLS": true,
"errorCallbacks": {},
"connectionCallbacks": {},
"handshakeCallbacks": {},
"strategy": {
"strategy": {
"strategy": {
"trueBranch": {
"strategies": [
{
"strategies": [
{
"name": "ws",
"priority": 3,
"transport": {
"manager": {
"options": {
"lives": 2,
"minPingDelay": 10000,
"maxPingDelay": 120000
},
"livesLeft": 2
},
"transport": {
"hooks": {
"urls": {},
"handlesActivityChecks": false,
"supportsPing": false
}
},
"minPingDelay": 10000,
"maxPingDelay": 120000
},
"options": {
"key": key,
"useTLS": true,
"hostNonTLS": "ws-ap1.pusher.com:80",
"hostTLS": "ws-ap1.pusher.com:443",
"httpPath": ""
}
}
],
"loop": true,
"failFast": false,
"timeout": 15000,
"timeoutLimit": 60000
},
{
"strategy": {
"trueBranch": {
"strategies": [
{
"trueBranch": {
"strategies": [
{
"strategies": [
{
"trueBranch": {
"name": "xhr_streaming",
"priority": 1,
"transport": {
"manager": {
"options": {
"lives": 2,
"minPingDelay": 10000,
"maxPingDelay": 120000
},
"livesLeft": 2
},
"transport": {},
"minPingDelay": 10000,
"maxPingDelay": 120000
},
"options": {
"key": key,
"useTLS": true,
"hostNonTLS": "sockjs-ap1.pusher.com:80",
"hostTLS": "sockjs-ap1.pusher.com:443",
"httpPath": "/pusher"
}
},
"falseBranch": {
"name": "xdr_streaming",
"priority": 1,
"transport": {
"transport": {
"hooks": {
"urls": {},
"handlesActivityChecks": false,
"supportsPing": true
}
},
"minPingDelay": 10000,
"maxPingDelay": 120000
},
"options": {
"key": key,
"useTLS": true,
"hostNonTLS": "sockjs-ap1.pusher.com:80",
"hostTLS": "sockjs-ap1.pusher.com:443",
"httpPath": "/pusher"
}
}
}
],
"loop": true,
"failFast": false,
"timeout": 15000,
"timeoutLimit": 60000
},
{
"strategy": {
"strategies": [
{
"trueBranch": {
"name": "xhr_polling",
"priority": 1,
"transport": {
"hooks": {
"urls": {},
"handlesActivityChecks": false,
"supportsPing": true
}
},
"options": {
"key": key,
"useTLS": true,
"hostNonTLS": "sockjs-ap1.pusher.com:80",
"hostTLS": "sockjs-ap1.pusher.com:443",
"httpPath": "/pusher"
}
},
"falseBranch": {
"name": "xdr_polling",
"priority": 1,
"transport": {
"hooks": {
"urls": {},
"handlesActivityChecks": false,
"supportsPing": true
}
},
"options": {
"key": key,
"useTLS": true,
"hostNonTLS": "sockjs-ap1.pusher.com:80",
"hostTLS": "sockjs-ap1.pusher.com:443",
"httpPath": "/pusher"
}
}
}
],
"loop": true,
"failFast": false,
"timeout": 15000,
"timeoutLimit": 60000
},
"options": {
"delay": 4000
}
}
]
}
}
],
"loop": true,
"failFast": false,
"timeout": 15000,
"timeoutLimit": 60000
},
"falseBranch": {
"strategies": [
{
"name": "sockjs",
"priority": 1,
"transport": {
"hooks": {
"file": "sockjs",
"urls": {},
"handlesActivityChecks": true,
"supportsPing": false
}
},
"options": {
"key": key,
"useTLS": true,
"hostNonTLS": "sockjs-ap1.pusher.com:80",
"hostTLS": "sockjs-ap1.pusher.com:443",
"httpPath": "/pusher"
}
}
],
"loop": true,
"failFast": false,
"timeout": 15000,
"timeoutLimit": 60000
}
},
"options": {
"delay": 2000
}
}
]
}
}
},
"transports": {
"wss": {
"name": "wss",
"priority": 3,
"transport": {
"minPingDelay": 10000,
"maxPingDelay": 120000
},
"options": {
"key": key,
"useTLS": true,
"hostNonTLS": "ws-ap1.pusher.com:80",
"hostTLS": "ws-ap1.pusher.com:443",
"httpPath": ""
}
}
},
"ttl": 1800000,
"usingTLS": true
},
"runner": null,
"unavailableTimer": {
"timer": null
},
"activityTimeout": 120000,
"activityTimer": {
"timer": 5
},
"socket_id": "17356.8786996"
},
"user": {
"callbacks": {
"_callbacks": {}
},
"global_callbacks": [],
"signin_requested": false,
"user_data": null,
"serverToUserChannel": null
}
},
"channels": {}
}
}
Pusher Dashboard doesn't show that channel is being listened to
EDIT
It currently shows on the pusher dashboard that the channel is being listened to but laravel-echo doesn't catch the event on the front end

Using loadable, common files are bundled into a common bundle

I am using loadable for code splitting. The problem is all my files which are being used in more than one file are bundle into my initial bundle which is making it too large. Instead I want them to be included in my particular route bundle which is opened. How can I solve this?
I want my files to be included in route bundle only. I don't want any common bundle.
This is my webpack config
{
"cache": true,
"context": "/src/client",
"entry": {
"desktop": "./app.desktop.jsx",
"mobile": "./app.mobile.jsx"
},
"output": {
"path": "repo_name/dist/js",
"pathinfo": false,
"publicPath": "https://{url}/js/",
"chunkFilename": "[contenthash].[name].js",
"filename": "[name].bundle.[contenthash].js"
},
"resolve": {
"alias": {},
"symlinks": true,
"plugins": [{
"source": "module",
"nmPath": "node_modules",
"originDir": "repo_name/node_modules/electrode-archetype-react-app-dev",
"target": "resolve"
}],
"modules": [
"repo_name/src",
"repo_name",
"node_modules"
],
"extensions": [
".js",
".jsx",
".json"
]
},
"resolveLoader": {
"symlinks": true,
"modules": [
"repo_name/lib",
"repo_name"
],
"plugins": [{
"source": "module",
"nmPath": "node_modules",
"originDir": "repo_name/node_modules/electrode-archetype-react-app-dev",
"target": "resolve"
}]
},
"module": {
"rules": [{
"test": {},
"use": [{
"loader": "repo_name/node_modules/babel-loader/lib/index.js",
"options": {
"cacheDirectory": "repo_name/.etmp/babel-loader"
}
}]
},
{
"test": {},
"use": [{
"loader": "repo_name/node_modules/mini-css-extract-plugin/dist/loader.js",
"options": {
"hmr": false,
"reload": false,
"publicPath": "/js/"
}
},
{
"loader": "repo_name/node_modules/css-loader/index.js",
"options": {
"context": "repo_name/src",
"modules": true,
"localIdentName": "[hash:base64:5]"
}
},
{
"loader": "repo_name/node_modules/postcss-loader/src/index.js",
"options": {
"ident": "postcss"
}
}
]
},
{
"test": {},
"use": [{
"loader": "repo_name/node_modules/mini-css-extract-plugin/dist/loader.js",
"options": {
"hmr": false,
"reload": false,
"publicPath": ""
}
},
{
"loader": "repo_name/node_modules/css-loader/index.js",
"options": {
"context": "repo_name/src",
"modules": true,
"localIdentName": "[hash:base64:5]"
}
},
{
"loader": "repo_name/node_modules/postcss-loader/src/index.js",
"options": {
"ident": "postcss"
}
},
{
"loader": "repo_name/node_modules/sass-loader/lib/loader.js"
}
]
},
{
"test": {},
"use": [{
"loader": "repo_name/node_modules/mini-css-extract-plugin/dist/loader.js",
"options": {
"hmr": false,
"reload": false,
"publicPath": ""
}
},
{
"loader": "repo_name/node_modules/css-loader/index.js",
"options": {
"context": "repo_name/src",
"modules": true,
"localIdentName": "[hash:base64:5]"
}
},
{
"loader": "repo_name/node_modules/postcss-loader/src/index.js",
"options": {
"ident": "postcss"
}
},
{
"loader": "repo_name/node_modules/stylus-relative-loader/index.js"
}
]
},
{
"test": {},
"use": [{
"loader": "repo_name/node_modules/url-loader/index.js",
"options": {
"limit": 1000,
"mimetype": "application/font-woff"
}
},
"repo_name/node_modules/isomorphic-loader/index.js"
]
},
{
"test": {},
"use": [
"repo_name/node_modules/file-loader/dist/cjs.js",
"repo_name/node_modules/isomorphic-loader/index.js"
]
},
{
"test": {},
"use": [{
"loader": "repo_name/node_modules/electrode-cdn-file-loader/index.js",
"options": {
"limit": 10000
}
},
"repo_name/node_modules/isomorphic-loader/index.js"
]
}
]
},
"plugins": [{
"options": {
"filename": "[name].style.[contenthash].css",
"chunkFilename": "[name].style.[contenthash].css"
},
"__name": "MiniCssExtractPlugin"
},
{
"pluginDescriptor": {
"name": "OptimizeCssAssetsWebpackPlugin"
},
"options": {
"assetProcessors": [{
"phase": "compilation.optimize-chunk-assets",
"regExp": {}
}],
"assetNameRegExp": {},
"cssProcessorOptions": {
"zindex": false
},
"cssProcessorPluginOptions": {}
},
"phaseAssetProcessors": {
"compilation.optimize-chunk-assets": [{
"phase": "compilation.optimize-chunk-assets",
"regExp": {}
}],
"compilation.optimize-assets": [],
"emit": []
},
"deleteAssetsMap": {},
"__name": "OptimizeCssAssetsWebpackPlugin"
},
{
"options": {
"minimize": true,
"options": {
"context": "repo_name/src"
},
"test": {}
},
"__name": "LoaderOptionsPlugin"
},
{
"opts": {
"filename": "../server/stats.json",
"fields": [
"assetsByChunkName",
"assets",
"entrypoints",
"chunks"
]
},
"__name": "StatsWriterPlugin"
},
{
"config": {
"valid": false
},
"options": {
"assetsFile": "../isomorphic-assets.json",
"configFile": "repo_name/.isomorphic-loader-config.json",
"webpackDev": {
"url": "http://localhost:2992",
"addUrl": false
}
},
"__name": "IsomorphicLoaderPlugin"
},
{
"opts": {
"filename": "../server/loadable-stats.json",
"outputAsset": true
},
"compiler": null,
"__name": "LoadablePlugin"
},
{
"resourceRegExp": {},
"newContentRegExp": {},
"__name": "ContextReplacementPlugin"
},
{
"sourceMapFilename": "../map/[file].map",
"sourceMappingURLComment": "\n//# sourceMappingURL=/map/[url]",
"moduleFilenameTemplate": "webpack://[namespace]/[resourcePath]",
"fallbackModuleFilenameTemplate": "webpack://[namespace]/[resourcePath]?[hash]",
"namespace": "",
"options": {
"filename": "../map/[file].map",
"append": "\n//# sourceMappingURL=/map/[url]"
},
"__name": "SourceMapDevToolPlugin"
},
{
"isWatch": true,
"__name": "FailPlugin"
},
{
"__name": "DonePlugin"
},
{
"opts": {
"analyzerMode": "server",
"analyzerHost": "127.0.0.1",
"analyzerPort": 8888,
"reportFilename": "report.html",
"defaultSizes": "parsed",
"openAnalyzer": true,
"generateStatsFile": false,
"statsFilename": "stats.json",
"statsOptions": null,
"excludeAssets": null,
"logLevel": "info",
"startAnalyzer": true
},
"server": null,
"logger": {
"activeLevels": {}
}
},
{
"options": {},
"timeEventData": {},
"smpPluginAdded": true
}
],
"mode": "production",
"optimization": {
"splitChunks": {
"cacheGroups": {
"node_vendors": {
"name": "node_vendor",
"test": {},
"chunks": "initial",
"priority": 1
},
"sentry": {
"name": "sentry",
"test": {},
"chunks": "all",
"priority": 10
}
}
}
}
}

ElasticSearch difference aggregation

This is a piece of my data stored :
[
{
"name": "disk.device.write.requests",
"type": "cumulative",
"unit": "request",
"volume": 0,
"user_id": "b0407ee332f6474c87d1e666262d4783",
"project_id": "75ebb9556f8c4e36b0d3e722a57ff3bb",
"resource_id": "7837ab92-5eb7-4cdc-9da3-5f1d2a385841-hda",
"timestamp": "2021-11-14T13:28:45.873289",
"resource_metadata": {
"display_name": "ali",
"name": "instance-00000004",
"instance_id": "7837ab92-5eb7-4cdc-9da3-5f1d2a385841",
"instance_type": "Tochal",
"host": "b34b47c6129603ae3d0387bfa8bf8fe487b0a8424d7e3debb6c69b6d",
"instance_host": "os",
"flavor": {
"id": "t1",
"name": "Tochal",
"vcpus": 4,
"ram": 4096,
"disk": 40,
"ephemeral": 0,
"swap": 0
},
"status": "active",
"state": "running",
"task_state": "",
"image": {
"id": "f77ec16e-1c4e-4ed7-b340-b537ab008367"
},
"image_ref": "f77ec16e-1c4e-4ed7-b340-b537ab008367",
"image_ref_url": null,
"architecture": "x86_64",
"os_type": "hvm",
"vcpus": 4,
"memory_mb": 4096,
"disk_gb": 40,
"ephemeral_gb": 0,
"root_gb": 40,
"disk_name": "hda"
},
"source": "openstack",
"id": "cafd91ab-454e-11ec-b8ba-3b125e027b37",
"monotonic_time": null
}
...]
I've written an aggregation to group data in one hour by name field for a project:
{
index: 'cm',
size: 0,
pretty: true,
body: {
query: {
bool: {
must: [
{
match: {
project_id: '75ebb9556f8c4e36b0d3e722a57ff3bb',
},
},
{
range: {
timestamp: {
gte: 'now-1H',
},
},
},
],
},
},
aggs: {
names: {
terms: { field: 'name' },
aggs: {
myvalue: { sum: { field: 'volume' } },
},
},
},
},
}
And it's output is:
"aggregations": {
"names": {
"doc_count_error_upper_bound": 0,
"sum_other_doc_count": 4,
"buckets": [
{
"key": "disk.device.read.bytes",
"doc_count": 8,
"hatprice": {
"value": 2311073040
}
},
{
"key": "disk.device.read.requests",
"doc_count": 8,
"hatprice": {
"value": 68796
}
},
{
"key": "disk.device.write.bytes",
"doc_count": 8,
"hatprice": {
"value": 13117853696
}
},
{
"key": "disk.device.write.requests",
"doc_count": 8,
"hatprice": {
"value": 776618
}
},
{
"key": "cpu",
"doc_count": 4,
"hatprice": {
"value": 4541150000000
}
},
{
"key": "memory.usage",
"doc_count": 4,
"hatprice": {
"value": 1741
}
},
{
"key": "network.incoming.bytes",
"doc_count": 4,
"hatprice": {
"value": 532735722
}
},
{
"key": "network.incoming.packets",
"doc_count": 4,
"hatprice": {
"value": 864945
}
},
{
"key": "network.outgoing.bytes",
"doc_count": 4,
"hatprice": {
"value": 58562803
}
},
{
"key": "network.outgoing.packets",
"doc_count": 4,
"hatprice": {
"value": 439204
}
}
]
}
}
I need to aggregate base on volume field minus previous hour volume value.
Is it possible?
e.g: network.incoming.bytes in current hour. (not from first).
I think I've solved the problem using SERIAL_DIFF but not sure:
{
index: 'cm',
size: 0,
pretty: true,
body: {
query: {
bool: {
must: [
{
match: {
project_id: '75ebb9556f8c4e36b0d3e722a57ff3bb',
},
},
{
range: {
timestamp: {
gte: 'now-2H',
},
},
},
],
},
},
aggs: {
names: {
terms: { field: 'name' },
aggs: {
mydateh: {
date_histogram: {
field: 'timestamp',
calendar_interval: 'hour',
},
aggs: {
volrate: { max: { field: 'volume' } },
diff: {
serial_diff: {
buckets_path: 'volrate',
lag: 1,
},
},
},
},
},
},
},
},
}

AmCharts - Slice labels outside of chart div

When I create a funnel chart with a lot of data, the labels are going outside of the chart div, like this
Is it possible to fix this or do I need to create another div with legends only ?
var userInfo = JSON.parse('#Html.Raw(DataJson)');
var chart = AmCharts.makeChart("chartdiv", {
"type": "funnel",
"theme": "light",
"dataProvider": userInfo,
"balloon": {
"fixedPosition": false
},
"valueField": "Quantidade",
"titleField": "Variac",
"marginRight": 250,
"marginLeft": 30,
"startX": 0,
"depth3D": 50,
"angle": 25,
"outlineAlpha": 1,
"outlineColor": "#FFFFFF",
"outlineThickness": 0.5,
"labelPosition": "right",
"balloonText": "[[Variac]]: [[Quantidade]]",
});
Here is a demo that illustrates the problem.
http://jsfiddle.net/abngzewr/3/
There isn't a way to prevent labels from leaving the chart div, but you can work around this by setting a hideLabelsPercent value that hides the smaller slices and then create a legend that lists all the slices.
AmCharts.makeChart("chartdiv", {
// ...
hideLabelsPercent: 2, //hide labels of slices that take up < 2% in size
// ...
});
Since you have a lot of data, you can create a legend in an external div using divId so you have room for both the chart and legend separately.
var chart = AmCharts.makeChart("chartdiv", {
"type": "funnel",
"theme": "light",
"dataProvider": [{
"title": "Website visits",
"value": 200
}, {
"title": "Downloads",
"value": 123
}, {
"title": "Requested price list",
"value": 98
}, {
"title": "Contaced for more info",
"value": 72
}, {
"title": "Purchased",
"value": 35
}, {
"title": "Contacted for support",
"value": 35
}, {
"title": "Purchased additional products",
"value": 26
},
{
"title": "Downloads",
"value": 123
}, {
"title": "Requested price list",
"value": 98
}, {
"title": "Contaced for more info",
"value": 72
}, {
"title": "Purchased",
"value": 35
}, {
"title": "Contacted for support",
"value": 35
},
{
"title": "Downloads",
"value": 123
}, {
"title": "Requested price list",
"value": 98
}, {
"title": "Contaced for more info",
"value": 72
}, {
"title": "Purchased",
"value": 35
}, {
"title": "Contacted for support",
"value": 35
},
{
"title": "Downloads",
"value": 123
}, {
"title": "Requested price list",
"value": 98
}, {
"title": "Contaced for more info",
"value": 72
}, {
"title": "Purchased",
"value": 35
}, {
"title": "Contacted for support",
"value": 35
},
{
"title": "Downloads",
"value": 123
}, {
"title": "Requested price list",
"value": 98
}, {
"title": "Contaced for more info",
"value": 72
}, {
"title": "Purchased",
"value": 35
}, {
"title": "Contacted for support",
"value": 35
}, {
"title": "Purchased",
"value": 35
}, {
"title": "Purchased",
"value": 35
}, {
"title": "Purchased",
"value": 35
}, {
"title": "Purchased",
"value": 35
}, {
"title": "Purchased",
"value": 35
}, {
"title": "Purchased",
"value": 35
}, {
"title": "Purchased",
"value": 35
}, {
"title": "Purchased",
"value": 35
}, {
"title": "Purchased",
"value": 35
}, {
"title": "Purchased",
"value": 35
}, {
"title": "Purchased",
"value": 35
}, {
"title": "Purchased",
"value": 35
}, {
"title": "Purchased",
"value": 35
}, {
"title": "Purchased",
"value": 35
}, {
"title": "Purchased",
"value": 35
}, {
"title": "Purchased",
"value": 35
},
],
"balloon": {
"fixedPosition": true
},
"valueField": "value",
"titleField": "title",
"marginRight": 250,
"marginLeft": 30,
"startX": 0,
"depth3D": 50,
"angle": 25,
"outlineAlpha": 1,
"outlineColor": "#FFFFFF",
"hideLabelsPercent": 2,
"outlineThickness": 2,
"labelPosition": "right",
"balloonText": "[[title]]: [[value]]n[[description]]",
"export": {
"enabled": true
},
"legend": {
"divId": "legenddiv"
}
});
#chartdiv {
width: 100%;
height: 500px;
}
#legenddiv {
position: relative;
}
<script src="https://www.amcharts.com/lib/3/amcharts.js"></script>
<script src="https://www.amcharts.com/lib/3/funnel.js"></script>
<script src="https://www.amcharts.com/lib/3/plugins/export/export.min.js"></script>
<link rel="stylesheet" href="https://www.amcharts.com/lib/3/plugins/export/export.css" type="text/css" media="all" />
<script src="https://www.amcharts.com/lib/3/themes/light.js"></script>
<div id="chartdiv"></div>
<div id="legenddiv"></div>

Cloudformation - 'AWS_PROXY' currently only supports Lambda function

I have the following error when I want to create a stack with cloudformation:
The following resource(s) failed to create: [ApiSyncLogsPost]. . Rollback requested by user.
CREATE_FAILED AWS::ApiGateway::Method ApiSyncLogsPost Integrations of type 'AWS_PROXY' currently only supports Lambda function and Firehose stream invocations. (Service: AmazonApiGateway; Status Code: 400; Error Code: BadRequestException; Request ID: 8bff48b0-93e4-11e8-a183-5de2b976f282)
I didn't find anything relevant regarding this error on google, when I search about it I just get a lot of AWS cloudformation documentation.
What I think is happening is that ApiSyncLogsPost resource is not defined properly, but the examples I found on the internet are similar.
What needs to be changed to solve that error?
Here is the cloudformation json:
{
"AWSTemplateFormatVersion": "2010-09-09",
"Metadata": {
"AWS::CloudFormation::Designer": {
"a73e3686-2291-49a2-b052-565c5f85a9c9": {
"size": {
"width": 60,
"height": 60
},
"position": {
"x": 270,
"y": 120
},
"z": 2,
"parent": "d68e59d4-72c0-425a-9b7b-227cbac3252d",
"embeds": []
},
"0665ec07-964b-4c90-86c5-5f7731cece7b": {
"size": {
"width": 60,
"height": 60
},
"position": {
"x": 420,
"y": 120
},
"z": 1,
"embeds": []
},
"d68e59d4-72c0-425a-9b7b-227cbac3252d": {
"size": {
"width": 300,
"height": 240
},
"position": {
"x": 60,
"y": 90
},
"z": 1,
"embeds": [
"a73e3686-2291-49a2-b052-565c5f85a9c9",
"2cefafdd-86fd-4cbe-b42e-c638a8c23a19"
],
"iscontainedinside": [
"a86c6b83-5254-4848-943e-db6e35f09bf6"
]
},
"2cefafdd-86fd-4cbe-b42e-c638a8c23a19": {
"size": {
"width": 60,
"height": 60
},
"position": {
"x": 60,
"y": 120
},
"z": 2,
"parent": "d68e59d4-72c0-425a-9b7b-227cbac3252d",
"embeds": [],
"iscontainedinside": [
"d68e59d4-72c0-425a-9b7b-227cbac3252d",
"d68e59d4-72c0-425a-9b7b-227cbac3252d",
"a86c6b83-5254-4848-943e-db6e35f09bf6"
]
},
"a86c6b83-5254-4848-943e-db6e35f09bf6": {
"size": {
"width": 330,
"height": 330
},
"position": {
"x": 510,
"y": 90
},
"z": 1,
"embeds": [
"66745c5a-f3ad-4b8c-b575-e90d73cbf19b",
"cf340921-6a8b-45f2-8a2a-14ffb0e537e8",
"925587cf-52b3-4507-9131-6be6777905fe"
]
},
"66745c5a-f3ad-4b8c-b575-e90d73cbf19b": {
"size": {
"width": 60,
"height": 60
},
"position": {
"x": 540,
"y": 150
},
"z": 2,
"parent": "a86c6b83-5254-4848-943e-db6e35f09bf6",
"embeds": [],
"iscontainedinside": [
"a86c6b83-5254-4848-943e-db6e35f09bf6"
]
},
"cf340921-6a8b-45f2-8a2a-14ffb0e537e8": {
"size": {
"width": 60,
"height": 60
},
"position": {
"x": 680,
"y": 200
},
"z": 2,
"parent": "a86c6b83-5254-4848-943e-db6e35f09bf6",
"embeds": [],
"iscontainedinside": [
"a86c6b83-5254-4848-943e-db6e35f09bf6"
]
},
"925587cf-52b3-4507-9131-6be6777905fe": {
"size": {
"width": 60,
"height": 60
},
"position": {
"x": 540,
"y": 270
},
"z": 2,
"parent": "a86c6b83-5254-4848-943e-db6e35f09bf6",
"embeds": [],
"iscontainedinside": [
"a86c6b83-5254-4848-943e-db6e35f09bf6"
],
"dependson": [
"2cefafdd-86fd-4cbe-b42e-c638a8c23a19"
]
}
}
},
"Parameters": {
"DatabaseUrl": {
"Description": "DATABASE_URL taken from elastic bean. Example: postgres://my_own_user:my_own_access#my_own_link.rds.amazonaws.com:PORT/my_database_name",
"Type": "String"
},
"LogentriesToken": {
"Description": "",
"Type": "String"
},
"RedisUrl": {
"Description": "",
"Type": "String"
},
"DeploymentStage": {
"Description": "",
"Type": "String",
"Default": "staging"
},
"StackResourcePrefix": {
"Description": "The name will be used to create all the resources that belongs to the same stack.",
"Default": "StagingSyncLogs",
"Type": "String"
}
},
"Resources": {
"ErrorCfn": {
"Type": "AWS::ApiGateway::Model",
"Properties": {
"ContentType": "application/json",
"Name": "ErrorCfn",
"RestApiId": {
"Ref": "SyncLogsApi"
},
"Schema": {
"$schema": "http://json-schema.org/draft-04/schema#",
"title": "Error Schema",
"type": "object",
"properties": {
"message": {
"type": "string"
}
}
}
},
"Metadata": {
"AWS::CloudFormation::Designer": {
"id": "cf340921-6a8b-45f2-8a2a-14ffb0e537e8"
}
}
},
"UserPropertyModel": {
"Type": "AWS::ApiGateway::Model",
"Properties": {
"ContentType": "application/json",
"Name": "UserPropertyModel",
"RestApiId": {
"Ref": "SyncLogsApi"
},
"Schema": {
"$schema": "http://json-schema.org/draft-04/schema#",
"title": "UserPropertyModel",
"type": "object",
"properties": {
"Name": {
"type": "string"
}
}
}
},
"Metadata": {
"AWS::CloudFormation::Designer": {
"id": "66745c5a-f3ad-4b8c-b575-e90d73cbf19b"
}
}
},
"LambdaExecutionRole": {
"Type": "AWS::IAM::Role",
"Properties": {
"AssumeRolePolicyDocument": {
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Principal": {
"Service": [
"lambda.amazonaws.com"
]
},
"Action": [
"sts:AssumeRole"
]
}
]
},
"Path": "/",
"Policies": [
{
"PolicyName": "PolicyNameForLambdaRole",
"PolicyDocument": {
"Version": "2012-10-17",
"Statement": [
{
"Sid": "1",
"Effect": "Allow",
"Action": [
"lambda:InvokeFunction"
],
"Resource": [
"*"
]
},
{
"Sid": "2",
"Effect": "Allow",
"Action": [
"logs:CreateLogGroup",
"logs:CreateLogStream",
"logs:PutLogEvents"
],
"Resource": [
"*"
]
}
]
}
}
],
"RoleName": {
"Fn::Join": [
"_",
[
{
"Ref": "StackResourcePrefix"
},
"PostgresCron",
"Role"
]
]
}
},
"Metadata": {
"AWS::CloudFormation::Designer": {
"id": "0665ec07-964b-4c90-86c5-5f7731cece7b"
}
}
},
"SyncLogsLambda": {
"Type": "AWS::Lambda::Function",
"Properties": {
"Code": {
"S3Bucket": "myBucket456464",
"S3Key": "myCode34535.zip"
},
"Environment": {
"Variables": {
"DATABASE_URL": {
"Ref": "DatabaseUrl"
},
"LOGENTRIES_TOKEN": {
"Ref": "LogentriesToken"
},
"REDIS_URL": {
"Ref": "RedisUrl"
}
}
},
"Tags": [
{
"Key": "DeploymentStage",
"Value": {
"Ref": "DeploymentStage"
}
}
],
"FunctionName": {
"Fn::Join": [
"",
[
{
"Ref": "StackResourcePrefix"
},
"_",
"lambda"
]
]
},
"Description": "Lambda function for syncing logs to logentries",
"Handler": "index.handler",
"Runtime": "nodejs6.10",
"MemorySize": 128,
"Timeout": 300,
"Role": {
"Fn::GetAtt": [
"LambdaExecutionRole",
"Arn"
]
}
},
"Metadata": {
"AWS::CloudFormation::Designer": {
"id": "a73e3686-2291-49a2-b052-565c5f85a9c9"
}
}
},
"ProxyResource": {
"Type": "AWS::ApiGateway::Resource",
"Properties": {
"RestApiId": {
"Ref": "SyncLogsApi"
},
"ParentId": {
"Fn::GetAtt": [
"SyncLogsApi",
"RootResourceId"
]
},
"PathPart": "synclogs"
},
"Metadata": {
"AWS::CloudFormation::Designer": {
"id": "d68e59d4-72c0-425a-9b7b-227cbac3252d"
}
}
},
"SyncLogsApi": {
"Type": "AWS::ApiGateway::RestApi",
"Properties": {
"Name": "Sync logs Api",
"Description": "Sync logs when this link is called.",
"FailOnWarnings": true
},
"Metadata": {
"AWS::CloudFormation::Designer": {
"id": "a86c6b83-5254-4848-943e-db6e35f09bf6"
}
}
},
"ApiSyncLogsPost": {
"Type": "AWS::ApiGateway::Method",
"Properties": {
"ResourceId": {
"Ref": "ProxyResource"
},
"RestApiId": {
"Ref": "SyncLogsApi"
},
"HttpMethod": "POST",
"AuthorizationType": "NONE",
"Integration": {
"Type": "AWS_PROXY",
"IntegrationHttpMethod": "POST",
"Uri": {
"Fn::Join": [
"",
[
"arn:aws:apigateway:",
{
"Ref": "AWS::Region"
},
":lambda:path/2015-03-31/functions/",
{
"Fn::GetAtt": [
"SyncLogsLambda",
"Arn"
]
},
"/synclogs"
]
]
}
},
"MethodResponses": [
{
"ResponseModels": {
"application/json": {
"Ref": "UserPropertyModel"
}
},
"StatusCode": 200
},
{
"ResponseModels": {
"application/json": {
"Ref": "ErrorCfn"
}
},
"StatusCode": 404
},
{
"ResponseModels": {
"application/json": {
"Ref": "ErrorCfn"
}
},
"StatusCode": 500
}
]
},
"Metadata": {
"AWS::CloudFormation::Designer": {
"id": "2cefafdd-86fd-4cbe-b42e-c638a8c23a19"
}
}
},
"RestApiDeployment": {
"Type": "AWS::ApiGateway::Deployment",
"Properties": {
"RestApiId": {
"Ref": "SyncLogsApi"
},
"StageName": "Staging"
},
"DependsOn": [
"ApiSyncLogsPost"
],
"Metadata": {
"AWS::CloudFormation::Designer": {
"id": "925587cf-52b3-4507-9131-6be6777905fe"
}
}
}
}
}
The error is due to improper value for Integration.Uri in the ApiSyncLogsPost resource. The Uri should have the form:
arn:aws:apigateway:{region}:{subdomain.service|service}:path|action/{service_api}
Example:
arn:aws:apigateway:eu-west-1:lambda:path/2015-03-31/functions/arn:aws:lambda:eu-west-1:012345678901:function:MyLambda/invocations
In your case, the string "/synclogs" at the end which should actually be "/invocations"
The following Integration.Uri for ApiSyncLogsPost should fix the issue:
{
"Uri": {
"Fn::Join": [
"",
[
"arn:aws:apigateway:",
{
"Ref": "AWS::Region"
},
":lambda:path/2015-03-31/functions/",
{
"Fn::GetAtt": [
"SyncLogsLambda",
"Arn"
]
},
"/invocations"
]
]
}
}

Resources