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
}
}
}
}
}
Related
I created some kibana dashboards and they are referencing to a kibana data view. This data view is currently default generated by Filebeat when i'm uploading the filebeat setup, etc. Therefore the data view gets a random Id and my dashboard gets a mising reference since those id's are changing. Now i want to configure somewhere the default created data view since my index- and template-pattern have fixed names and i could create a fixed data view. Then my Dashboards wouldn't go into "missing references". I searched the following sites:
https://www.elastic.co/guide/en/beats/filebeat/current/filebeat-installation-configuration.html
https://github.com/elastic/kibana/issues
I created the Dashboards within the kibana UI and exported them for easier integration within my filebeat project.
My filebeat.yml file
# ============================== Filebeat modules ==============================
filebeat.config.modules:
# Glob pattern for configuration loading
path: ${path.config}/modules.d/*.yml
# Set to true to enable config reloading
reload.enabled: false
# ======================= Elasticsearch template setting =======================
setup.template.settings:
index.number_of_shards: 1
setup.template.name: pac-filebeat-%{[agent.version]}
setup.template.pattern: pac-filebeat-%{[agent.version]}
setup.template.fields: ${path.config}/fields.yml
setup.dashboards.enabled: false
setup.dashboards.directory: ${path.config}\kibana\custom
# =================================== Kibana ===================================
# Starting with Beats version 6.0.0, the dashboards are loaded via the Kibana API.
# This requires a Kibana endpoint configuration.
setup.kibana:
# Kibana Host
# Scheme and port can be left out and will be set to the default (http and 5601)
# In case you specify and additional path, the scheme is required: http://localhost:5601/path
# IPv6 addresses should always be defined as: https://[2001:db8::1]:5601
host: "localhost:5601"
# ---------------------------- Elasticsearch Output ----------------------------
output.elasticsearch:
# Array of hosts to connect to.
hosts: ["localhost:9200"]
# Protocol - either `http` (default) or `https`.
protocol: "http"
index: pac-filebeat-%{[agent.version]}
# ================================= Processors =================================
processors:
- add_host_metadata:
when.not.contains.tags: forwarded
- add_cloud_metadata: ~
- add_docker_metadata: ~
- add_kubernetes_metadata: ~
# ================================== Logging ===================================
This is one example Dashboard.
{
"attributes": {
"description": "",
"hits": 0,
"kibanaSavedObjectMeta": {
"searchSourceJSON": {
"query": {
"query": "",
"language": "kuery"
},
"filter": []
}
},
"optionsJSON": {
"useMargins": true,
"syncColors": false,
"syncTooltips": false,
"hidePanelTitles": false
},
"panelsJSON": [
{
"version": "8.5.3",
"type": "lens",
"gridData": {
"x": 0,
"y": 0,
"w": 9,
"h": 10,
"i": "70779a3d-7880-416d-9736-8a374af8ae41"
},
"panelIndex": "70779a3d-7880-416d-9736-8a374af8ae41",
"embeddableConfig": {
"attributes": {
"title": "",
"visualizationType": "lnsLegacyMetric",
"type": "lens",
"references": [
{
"type": "index-pattern",
"id": "454f0a8e-d5b8-4c8d-9dbe-a1a61782d24d",
"name": "indexpattern-datasource-layer-2a27a515-43d0-4aae-8764-467983de9faf"
},
{
"type": "index-pattern",
"name": "99c2853a-48e3-4042-badf-9c0829cec119",
"id": "454f0a8e-d5b8-4c8d-9dbe-a1a61782d24d"
}
],
"state": {
"visualization": {
"layerId": "2a27a515-43d0-4aae-8764-467983de9faf",
"accessor": "10b01daf-1c3d-46d1-a014-b381ac70019c",
"layerType": "data"
},
"query": {
"query": "",
"language": "kuery"
},
"filters": [
{
"meta": {
"index": "99c2853a-48e3-4042-badf-9c0829cec119",
"alias": "pac.log.level : ERROR",
"type": "custom",
"key": "query",
"value": {
"bool": {
"must": [],
"filter": [
{
"bool": {
"should": [
{
"match": {
"pac.log.level": "ERROR"
}
}
],
"minimum_should_match": 1
}
}
],
"should": [],
"must_not": []
}
},
"disabled": false,
"negate": false
},
"query": {
"bool": {
"must": [],
"filter": [
{
"bool": {
"should": [
{
"match": {
"pac.log.level": "ERROR"
}
}
],
"minimum_should_match": 1
}
}
],
"should": [],
"must_not": []
}
},
"$state": {
"store": "appState"
}
}
],
"datasourceStates": {
"indexpattern": {
"layers": {
"2a27a515-43d0-4aae-8764-467983de9faf": {
"columns": {
"10b01daf-1c3d-46d1-a014-b381ac70019c": {
"label": "Errors",
"customLabel": true,
"dataType": "number",
"operationType": "count",
"isBucketed": false,
"scale": "ratio",
"sourceField": "pac.log.level",
"filter": {
"query": "pac.log.level : ERROR",
"language": "kuery"
},
"params": {
"emptyAsNull": true
}
}
},
"columnOrder": [
"10b01daf-1c3d-46d1-a014-b381ac70019c"
],
"incompleteColumns": {}
}
}
}
},
"internalReferences": [],
"adHocDataViews": {}
}
},
"enhancements": {}
}
},
{
"version": "8.5.3",
"type": "lens",
"gridData": {
"x": 9,
"y": 0,
"w": 12,
"h": 10,
"i": "2bbc2f60-dfb2-4545-a725-9f9bec323e4b"
},
"panelIndex": "2bbc2f60-dfb2-4545-a725-9f9bec323e4b",
"embeddableConfig": {
"attributes": {
"title": "",
"visualizationType": "lnsXY",
"type": "lens",
"references": [
{
"type": "index-pattern",
"id": "454f0a8e-d5b8-4c8d-9dbe-a1a61782d24d",
"name": "indexpattern-datasource-layer-a0f69cd9-6726-4551-9a91-cb330cf0b16d"
}
],
"state": {
"visualization": {
"legend": {
"isVisible": true,
"position": "right"
},
"valueLabels": "hide",
"fittingFunction": "None",
"xTitle": "",
"yTitle": "",
"axisTitlesVisibilitySettings": {
"x": false,
"yLeft": false,
"yRight": true
},
"tickLabelsVisibilitySettings": {
"x": true,
"yLeft": false,
"yRight": true
},
"labelsOrientation": {
"x": 0,
"yLeft": 0,
"yRight": 0
},
"gridlinesVisibilitySettings": {
"x": true,
"yLeft": false,
"yRight": true
},
"preferredSeriesType": "bar_horizontal_percentage_stacked",
"layers": [
{
"layerId": "a0f69cd9-6726-4551-9a91-cb330cf0b16d",
"seriesType": "bar_horizontal_percentage_stacked",
"accessors": [
"cbf5323b-0d81-4411-afa3-91087f062874"
],
"yConfig": [],
"layerType": "data",
"splitAccessor": "a98ba577-d539-4ab3-b798-2bddcb2efd3f",
"palette": {
"type": "palette",
"name": "status"
}
}
]
},
"query": {
"query": "",
"language": "kuery"
},
"filters": [],
"datasourceStates": {
"indexpattern": {
"layers": {
"a0f69cd9-6726-4551-9a91-cb330cf0b16d": {
"columns": {
"a98ba577-d539-4ab3-b798-2bddcb2efd3f": {
"label": "ESA states",
"dataType": "string",
"operationType": "terms",
"scale": "ordinal",
"sourceField": "pac.log.esa.connection",
"isBucketed": true,
"params": {
"size": 3,
"orderBy": {
"type": "column",
"columnId": "cbf5323b-0d81-4411-afa3-91087f062874"
},
"orderDirection": "desc",
"otherBucket": true,
"missingBucket": false,
"parentFormat": {
"id": "terms"
}
},
"customLabel": true
},
"cbf5323b-0d81-4411-afa3-91087f062874": {
"label": "Connected",
"dataType": "number",
"operationType": "unique_count",
"scale": "ratio",
"sourceField": "pac.log.esa.connection",
"isBucketed": false,
"filter": {
"query": "pac.log.esa.connection : Connected",
"language": "kuery"
},
"params": {
"emptyAsNull": true
},
"customLabel": true
}
},
"columnOrder": [
"a98ba577-d539-4ab3-b798-2bddcb2efd3f",
"cbf5323b-0d81-4411-afa3-91087f062874"
],
"incompleteColumns": {}
}
}
}
},
"internalReferences": [],
"adHocDataViews": {}
}
},
"enhancements": {}
}
},
{
"version": "8.5.3",
"type": "lens",
"gridData": {
"x": 21,
"y": 0,
"w": 7,
"h": 10,
"i": "ef851b6b-222a-4b70-a7c3-ec6a85bdf4d1"
},
"panelIndex": "ef851b6b-222a-4b70-a7c3-ec6a85bdf4d1",
"embeddableConfig": {
"attributes": {
"title": "",
"visualizationType": "lnsLegacyMetric",
"type": "lens",
"references": [
{
"type": "index-pattern",
"id": "454f0a8e-d5b8-4c8d-9dbe-a1a61782d24d",
"name": "indexpattern-datasource-layer-d8719702-b241-4931-8bd3-d706f1403c25"
}
],
"state": {
"visualization": {
"layerId": "d8719702-b241-4931-8bd3-d706f1403c25",
"accessor": "312ded46-d0e9-4dcf-9779-b0ca10249a90",
"layerType": "data"
},
"query": {
"query": "",
"language": "kuery"
},
"filters": [],
"datasourceStates": {
"indexpattern": {
"layers": {
"d8719702-b241-4931-8bd3-d706f1403c25": {
"columns": {
"312ded46-d0e9-4dcf-9779-b0ca10249a90": {
"label": "Failed DEO Executions",
"customLabel": true,
"dataType": "number",
"operationType": "count",
"isBucketed": false,
"scale": "ratio",
"sourceField": "pac.log.deo.status",
"filter": {
"query": "pac.log.deo.status : failed",
"language": "kuery"
},
"params": {
"emptyAsNull": true
}
}
},
"columnOrder": [
"312ded46-d0e9-4dcf-9779-b0ca10249a90"
],
"incompleteColumns": {}
}
}
}
},
"internalReferences": [],
"adHocDataViews": {}
}
},
"enhancements": {}
}
},
{
"version": "8.5.3",
"type": "lens",
"gridData": {
"x": 0,
"y": 10,
"w": 14,
"h": 11,
"i": "7bcd2a3e-54c1-4b09-a0b6-d41c339c2ae6"
},
"panelIndex": "7bcd2a3e-54c1-4b09-a0b6-d41c339c2ae6",
"embeddableConfig": {
"attributes": {
"title": "",
"visualizationType": "lnsXY",
"type": "lens",
"references": [
{
"type": "index-pattern",
"id": "454f0a8e-d5b8-4c8d-9dbe-a1a61782d24d",
"name": "indexpattern-datasource-layer-cd91feb0-0927-4465-b0fd-b5bac50af734"
}
],
"state": {
"visualization": {
"title": "Empty XY chart",
"legend": {
"isVisible": true,
"position": "right",
"showSingleSeries": true
},
"valueLabels": "hide",
"preferredSeriesType": "line",
"layers": [
{
"layerId": "cd91feb0-0927-4465-b0fd-b5bac50af734",
"accessors": [
"8ccc17fc-529e-4460-9925-149e77e37dd1"
],
"position": "top",
"seriesType": "line",
"showGridlines": false,
"layerType": "data",
"xAccessor": "43aa69d1-f806-4f87-a2b8-57718e85400a"
}
],
"yTitle": "",
"axisTitlesVisibilitySettings": {
"x": true,
"yLeft": false,
"yRight": true
}
},
"query": {
"query": "",
"language": "kuery"
},
"filters": [],
"datasourceStates": {
"indexpattern": {
"layers": {
"cd91feb0-0927-4465-b0fd-b5bac50af734": {
"columns": {
"43aa69d1-f806-4f87-a2b8-57718e85400a": {
"label": "#timestamp",
"dataType": "date",
"operationType": "date_histogram",
"sourceField": "#timestamp",
"isBucketed": true,
"scale": "interval",
"params": {
"interval": "auto",
"includeEmptyRows": true,
"dropPartials": false
}
},
"8ccc17fc-529e-4460-9925-149e77e37dd1": {
"label": " System cpu usage",
"dataType": "number",
"operationType": "median",
"sourceField": "pac.log.system.monitor.cpu.pct",
"isBucketed": false,
"scale": "ratio",
"params": {
"emptyAsNull": true,
"format": {
"id": "percent",
"params": {
"decimals": 2
}
}
},
"customLabel": true
}
},
"columnOrder": [
"43aa69d1-f806-4f87-a2b8-57718e85400a",
"8ccc17fc-529e-4460-9925-149e77e37dd1"
],
"incompleteColumns": {}
}
}
}
},
"internalReferences": [],
"adHocDataViews": {}
}
},
"enhancements": {}
}
}
],
"timeRestore": false,
"title": "ESA overview",
"version": 1
},
"coreMigrationVersion": "8.5.3",
"id": "d29c4ac0-ab68-11ed-bfcf-939f8111002e",
"migrationVersion": {
"dashboard": "8.5.0"
},
"references": [
{
"id": "454f0a8e-d5b8-4c8d-9dbe-a1a61782d24d",
"name": "70779a3d-7880-416d-9736-8a374af8ae41:indexpattern-datasource-layer-2a27a515-43d0-4aae-8764-467983de9faf",
"type": "index-pattern"
},
{
"id": "454f0a8e-d5b8-4c8d-9dbe-a1a61782d24d",
"name": "70779a3d-7880-416d-9736-8a374af8ae41:99c2853a-48e3-4042-badf-9c0829cec119",
"type": "index-pattern"
},
{
"id": "454f0a8e-d5b8-4c8d-9dbe-a1a61782d24d",
"name": "2bbc2f60-dfb2-4545-a725-9f9bec323e4b:indexpattern-datasource-layer-a0f69cd9-6726-4551-9a91-cb330cf0b16d",
"type": "index-pattern"
},
{
"id": "454f0a8e-d5b8-4c8d-9dbe-a1a61782d24d",
"name": "ef851b6b-222a-4b70-a7c3-ec6a85bdf4d1:indexpattern-datasource-layer-d8719702-b241-4931-8bd3-d706f1403c25",
"type": "index-pattern"
},
{
"id": "454f0a8e-d5b8-4c8d-9dbe-a1a61782d24d",
"name": "7bcd2a3e-54c1-4b09-a0b6-d41c339c2ae6:indexpattern-datasource-layer-cd91feb0-0927-4465-b0fd-b5bac50af734",
"type": "index-pattern"
},
{
"id": "c6a11f70-ab68-11ed-bfcf-939f8111002e",
"name": "tag-c6a11f70-ab68-11ed-bfcf-939f8111002e",
"type": "tag"
}
],
"type": "dashboard",
"updated_at": "2023-02-13T07:14:45.551Z",
"version": "WzE1NTI1NiwzMl0="
}
This would be the used tag inside the above dashboard
{
"attributes": {
"color": "#52bc22",
"description": "",
"name": "custom"
},
"coreMigrationVersion": "8.5.3",
"id": "c6a11f70-ab68-11ed-bfcf-939f8111002e",
"migrationVersion": {
"tag": "8.0.0"
},
"references": [],
"type": "tag",
"updated_at": "2023-02-13T07:39:07.543Z",
"version": "WzE1NTM0NywzMl0="
}
The error message:
error dashboard asset: returned 200 to import file: 1 error: error: missing_references, asset ID=d29c4ac0-ab68-11ed-bfcf-939f8111002e; asset type=dashboard; references=[{Type:index-pattern ID:454f0a8e-d5b8-4c8d-9dbe-a1a61782d24d} {Type:index-pattern ID:454f0a8e-d5b8-4c8d-9dbe-a1a61782d24d} {Type:index-pattern ID:454f0a8e-d5b8-4c8d-9dbe-a1a61782d24d} {Type:index-pattern ID:454f0a8e-d5b8-4c8d-9dbe-a1a61782d24d} {Type:index-pattern ID:454f0a8e-d5b8-4c8d-9dbe-a1a61782d24d}]. Response: {"successCount":1,"success":false,"warnings":[],"successResults":[{"type":"tag","id":"c6a11f70-ab68-11ed-bfcf-939f8111002e","meta":{"title":"custom","icon":"tag"},"overwrite":true}],"errors":[{"id":"d29c4ac0-ab68-11ed-bfcf-939f8111002e","type":"dashboard","meta":{"title":"ESA overview","icon":"dashboardApp"},"error":{"type":"missing_references","references":[{"type":"index-pattern","id":"454f0a8e-d5b8-4c8d-9dbe-a1a61782d24d"},{"type":"index-pattern","id":"454f0a8e-d5b8-4c8d-9dbe-a1a61782d24d"},{"type":"index-pattern","id":"454f0a8e-d5b8-4c8d-9dbe-a1a61782d24d"},{"type":"index-pattern","id":"454f0a8e-d5b8-4c8d-9dbe-a1a61782d24d"},{"type":"index-pattern","id":"454f0a8e-d5b8-4c8d-9dbe-a1a61782d24d"}]},"overwrite":true}]}
kind regardes
You can configure Filebeat to use your own dashboard using the following settings:
setup.dashboards.url
setup.dashboards.file
setup.dashboards.index
setup.dashboards.string_replacements (<-- probably the one you're looking for)
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
Trying to deploy a CloudFormation template gets stuck with 'AWS::ECS::Service' stuck on 'CREATE_IN_PROGRESS' with status 'Resource creation Initiated'.
Can anyone please tell me if there's a configuration problem with my CloudFormation template?
How would i troubleshoot this?
CloudFormation Template
Thank you!
"FargateTasksCluster": {
"Type": "AWS::ECS::Cluster"
},
"FargateTasksLogGroup": {
"Type": "AWS::Logs::LogGroup"
},
"MytaskTask": {
"Type": "AWS::ECS::TaskDefinition",
"Properties": {
"ContainerDefinitions": [{
"Name": "my-task",
"Image": "mountainpass/infrastructure:helloworld",
"Environment": [],
"LogConfiguration": {
"LogDriver": "awslogs",
"Options": {
"awslogs-region": {
"Fn::Sub": "${AWS::Region}"
},
"awslogs-group": {
"Fn::Sub": "${FargateTasksLogGroup}"
},
"awslogs-stream-prefix": "fargate"
}
}
}],
"Family": "my-task",
"NetworkMode": "awsvpc",
"ExecutionRoleArn": {
"Fn::Sub": "arn:aws:iam::${AWS::AccountId}:role/ecsTaskExecutionRole"
},
"TaskRoleArn": {
"Fn::Sub": "${IamRoleLambdaExecution}"
},
"RequiresCompatibilities": ["FARGATE"],
"Memory": "0.5GB",
"Cpu": 256
}
},
"MytaskService": {
"Type": "AWS::ECS::Service",
"Properties": {
"Cluster": {
"Fn::Sub": "${FargateTasksCluster}"
},
"LaunchType": "FARGATE",
"ServiceName": "my-task",
"DesiredCount": 1,
"TaskDefinition": {
"Fn::Sub": "${MytaskTask}"
},
"NetworkConfiguration": {
"AwsvpcConfiguration": {
"AssignPublicIp": "DISABLED",
"SecurityGroups": [],
"Subnets": ["subnet-2cc37974", "subnet-3c959d5b", "subnet-49d7d200"]
}
}
}
}
I am trying to create a SAM template (serverless.template) in visual studio to publish my API Gateway. I have a couple of errors being produced within the template validation (in Visual Studio) that I'm unable to resolve. When published, the stack deploys, but there is no usage plan(s) or api key(s) created (or rather, they are created but not viewable in the console, they come up as 'invalid reference' if you try to view them via Cloudformation > Resources, and they don't show up at all in the API Gateway console).
The errors are:
ServerlessRestApiDeployment26aad1646f is an unknown reference
"ServerlessRestApiProdStage": {
"Type": "AWS::ApiGateway::Stage",
"Properties": {
"DeploymentId": {
"Ref": "ServerlessRestApiDeployment26aad1646f"
},
"RestApiId": {
"Ref": "ServerlessRestApi"
},
"StageName": "Prod"
}
},
And
ServerlessRestApiProdStage is an invalid type for this reference
"APIGatewayHeartInHandKey": {
"Type": "AWS::ApiGateway::ApiKey",
"DependsOn": [
"ServerlessRestApi",
"ServerlessRestApiProdStage"
],
"Properties": {
"Name": "HeartInHandApiKey",
"Description": "Api Key for Heart In Hand",
"Enabled": true,
"GenerateDistinctId": true,
"StageKeys": [
{
"RestApiId": {
"Ref": "ServerlessRestApi"
},
"StageName": {
"Ref": "ServerlessRestApiProdStage"
}
}
]
}
},
The full SAM template shown below.
{
"AWSTemplateFormatVersion": "2010-09-09",
"Transform": "AWS::Serverless-2016-10-31",
"Description": "API Gateway to access InSite data-store",
"Resources": {
"Get": {
"Type": "AWS::Serverless::Function",
"Properties": {
"VpcConfig": {
"SecurityGroupIds": [
"sg-111a1476"
],
"SubnetIds": [
"subnet-3029a769",
"subnet-5ec0b928"
]
},
"Handler": "AWSServerlessInSiteDataGw::AWSServerlessInSiteDataGw.Functions::Get",
"Runtime": "dotnetcore2.0",
"CodeUri": "",
"MemorySize": 256,
"Timeout": 30,
"Role": null,
"Policies": [
"AWSLambdaBasicExecutionRole",
"AWSLambdaVPCAccessExecutionRole",
"AmazonSSMFullAccess"
],
"Events": {
"PutResource": {
"Type": "Api",
"Properties": {
"Path": "/",
"Method": "GET"
}
}
}
}
},
"GetTableBasic": {
"Type": "AWS::Serverless::Function",
"Properties": {
"VpcConfig": {
"SecurityGroupIds": [
"sg-111a1476"
],
"SubnetIds": [
"subnet-3029a769",
"subnet-5ec0b928"
]
},
"Handler": "AWSServerlessInSiteDataGw::AWSServerlessInSiteDataGw.Functions::GetTableBasic",
"Runtime": "dotnetcore2.0",
"CodeUri": "",
"MemorySize": 256,
"Timeout": 30,
"Role": null,
"Policies": [
"AWSLambdaBasicExecutionRole",
"AWSLambdaVPCAccessExecutionRole",
"AmazonSSMFullAccess"
],
"Events": {
"PutResource": {
"Type": "Api",
"Properties": {
"Path": "/tables/{tableid}/{columnid}",
"Method": "GET"
}
}
}
}
},
"GetColumnList": {
"Type": "AWS::Serverless::Function",
"Properties": {
"VpcConfig": {
"SecurityGroupIds": [
"sg-111a1476"
],
"SubnetIds": [
"subnet-3029a769",
"subnet-5ec0b928"
]
},
"Handler": "AWSServerlessInSiteDataGw::AWSServerlessInSiteDataGw.Functions::GetColumnList",
"Runtime": "dotnetcore2.0",
"CodeUri": "",
"MemorySize": 256,
"Timeout": 30,
"Role": null,
"Policies": [
"AWSLambdaBasicExecutionRole",
"AWSLambdaVPCAccessExecutionRole",
"AmazonSSMFullAccess"
],
"Events": {
"PutResource": {
"Type": "Api",
"Properties": {
"Path": "/list/columns/{tableid}",
"Method": "GET"
}
}
}
}
},
"GetTableList": {
"Type": "AWS::Serverless::Function",
"Properties": {
"VpcConfig": {
"SecurityGroupIds": [
"sg-111a1476"
],
"SubnetIds": [
"subnet-3029a769",
"subnet-5ec0b928"
]
},
"Handler": "AWSServerlessInSiteDataGw::AWSServerlessInSiteDataGw.Functions::GetTableList",
"Runtime": "dotnetcore2.0",
"CodeUri": "",
"MemorySize": 256,
"Timeout": 30,
"Role": null,
"Policies": [
"AWSLambdaBasicExecutionRole",
"AWSLambdaVPCAccessExecutionRole",
"AmazonSSMFullAccess"
],
"Events": {
"PutResource": {
"Type": "Api",
"Properties": {
"Path": "/list/tables",
"Method": "GET"
}
}
}
}
},
"PostClickCollectNotification": {
"Type": "AWS::Serverless::Function",
"Properties": {
"VpcConfig": {
"SecurityGroupIds": [
"sg-111a1476"
],
"SubnetIds": [
"subnet-3029a769",
"subnet-5ec0b928"
]
},
"Handler": "AWSServerlessInSiteDataGw::AWSServerlessInSiteDataGw.Functions::PostClickCollectNotification",
"Runtime": "dotnetcore2.0",
"CodeUri": "",
"MemorySize": 256,
"Timeout": 30,
"Role": null,
"Policies": [
"AWSLambdaBasicExecutionRole",
"AWSLambdaVPCAccessExecutionRole",
"AmazonSSMFullAccess"
],
"Events": {
"PutResource": {
"Type": "Api",
"Properties": {
"Path": "/datagw/general/webhook/ccnotify",
"Method": "POST"
}
}
}
}
},
"PostClickCollectStockUpdate": {
"Type": "AWS::Serverless::Function",
"Properties": {
"VpcConfig": {
"SecurityGroupIds": [
"sg-111a1476"
],
"SubnetIds": [
"subnet-3029a769",
"subnet-5ec0b928"
]
},
"Handler": "AWSServerlessInSiteDataGw::AWSServerlessInSiteDataGw.Functions::PostClickCollectStockUpdate",
"Runtime": "dotnetcore2.0",
"CodeUri": "",
"MemorySize": 256,
"Timeout": 30,
"Role": null,
"Policies": [
"AWSLambdaBasicExecutionRole",
"AWSLambdaVPCAccessExecutionRole",
"AmazonSSMFullAccess"
],
"Events": {
"PutResource": {
"Type": "Api",
"Properties": {
"Path": "/datagw/general/post/sohupdate",
"Method": "POST"
}
}
}
}
},
"GetTableResponse": {
"Type": "AWS::Serverless::Function",
"Properties": {
"VpcConfig": {
"SecurityGroupIds": [
"sg-111a1476"
],
"SubnetIds": [
"subnet-3029a769",
"subnet-5ec0b928"
]
},
"Handler": "AWSServerlessInSiteDataGw::AWSServerlessInSiteDataGw.Functions::GetTableResponse",
"Runtime": "dotnetcore2.0",
"CodeUri": "",
"MemorySize": 256,
"Timeout": 30,
"Role": null,
"Policies": [
"AWSLambdaBasicExecutionRole",
"AWSLambdaVPCAccessExecutionRole",
"AmazonSSMFullAccess"
],
"Events": {
"PutResource": {
"Type": "Api",
"Properties": {
"Path": "datagw/general/table/get/{tableid}",
"Method": "GET"
}
}
}
}
},
"ServerlessRestApi": {
"Type": "AWS::ApiGateway::RestApi",
"Properties": {
"Description":"This is a placeholder for the description of this web api",
"ApiKeySourceType":"HEADER",
"Body": {
"info": {
"version": "1.0",
"title": {
"Ref": "AWS::StackName"
}
},
"paths": {
"/list/tables": {
"get": {
"x-amazon-apigateway-integration": {
"httpMethod": "POST",
"type": "aws_proxy",
"uri": {
"Fn::Sub": "arn:aws:apigateway:${AWS::Region}:lambda:path/2015-03-31/functions/${GetTableList.Arn}/invocations"
}
},
"responses": {}
}
},
"/list/columns/{tableid}": {
"get": {
"x-amazon-apigateway-integration": {
"httpMethod": "POST",
"type": "aws_proxy",
"uri": {
"Fn::Sub": "arn:aws:apigateway:${AWS::Region}:lambda:path/2015-03-31/functions/${GetColumnList.Arn}/invocations"
}
},
"responses": {}
}
},
"datagw/general/table/get/{tableid}": {
"get": {
"x-amazon-apigateway-integration": {
"httpMethod": "POST",
"type": "aws_proxy",
"uri": {
"Fn::Sub": "arn:aws:apigateway:${AWS::Region}:lambda:path/2015-03-31/functions/${GetTableResponse.Arn}/invocations"
}
},
"responses": {}
}
},
"/": {
"get": {
"x-amazon-apigateway-integration": {
"httpMethod": "POST",
"type": "aws_proxy",
"uri": {
"Fn::Sub": "arn:aws:apigateway:${AWS::Region}:lambda:path/2015-03-31/functions/${Get.Arn}/invocations"
}
},
"responses": {}
}
},
"/tables/{tableid}/{columnid}": {
"get": {
"x-amazon-apigateway-integration": {
"httpMethod": "POST",
"type": "aws_proxy",
"uri": {
"Fn::Sub": "arn:aws:apigateway:${AWS::Region}:lambda:path/2015-03-31/functions/${GetTableBasic.Arn}/invocations"
}
},
"responses": {}
}
}
},
"swagger": "2.0"
}
}
},
"ServerlessRestApiProdStage": {
"Type": "AWS::ApiGateway::Stage",
"Properties": {
"DeploymentId": {
"Ref": "ServerlessRestApiDeployment26aad1646f"
},
"RestApiId": {
"Ref": "ServerlessRestApi"
},
"StageName": "Prod"
}
},
"CustomLambdaExecutionRole": {
"Type": "AWS::IAM::Role",
"Properties": {
"AssumeRolePolicyDocument": {
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Principal": {
"Service": [
"lambda.amazonaws.com"
]
},
"Action": [
"sts:AssumeRole"
]
}
]
},
"Policies": [
{
"PolicyName": "lambdaAccessApiKeys",
"PolicyDocument": {
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"apigateway:GET"
],
"Resource": {
"Fn::Sub": [
"arn:aws:apigateway:ap-southeast-2::/apikeys/${__keyId__}",
{
"__keyId__": {
"Ref": "APIGatewayHeartInHandKey"
}
}
]
}
}
]
}
}
]
}
},
"GetApiKeyValueLambdaFunction": {
"Type": "AWS::Lambda::Function",
"Properties": {
"Code": {
"ZipFile": {
"Fn::Join": [
"\n",
[
"import json",
"import boto3",
"client = boto3.client('apigateway')",
"def lambda_handler(event, context):",
" response = client.get_api_key(",
" apiKey= event['apiKeyId'],",
" includeValue = True",
")",
" return {",
" 'statusCode': 200,",
" 'body': response['value']}"
]
]
}
},
"Handler": "index.lambda_handler",
"Runtime": "python3.6",
"Timeout": 30,
"Role": {
"Fn::GetAtt": [
"CustomLambdaExecutionRole",
"Arn"
]
}
}
},
"APIGatewayUsagePlanInternal": {
"Type": "AWS::ApiGateway::UsagePlan",
"Properties": {
"ApiStages": [
{
"ApiId": {
"Ref": "ServerlessRestApi"
},
"Stage": {
"Ref": "ServerlessRestApiProdStage"
}
}
],
"Description": "Internal Apps Usage Plan",
"UsagePlanName": "Insite-datagw-InternalAppPlan"
}
},
"APIGatewayUsagePlanExternal": {
"Type": "AWS::ApiGateway::UsagePlan",
"Properties": {
"ApiStages": [
{
"ApiId": {
"Ref": "ServerlessRestApi"
},
"Stage": {
"Ref": "ServerlessRestApiProdStage"
}
}
],
"Description": "External Apps Usage Plan",
"UsagePlanName": "InSite-datagw-ExternalAppPlan"
}
},
"APIGatewayHeartInHandKey": {
"Type": "AWS::ApiGateway::ApiKey",
"DependsOn": [
"ServerlessRestApi",
"ServerlessRestApiProdStage"
],
"Properties": {
"Name": "HeartInHandApiKey",
"Description": "Api Key for Heart In Hand",
"Enabled": true,
"GenerateDistinctId": true,
"StageKeys": [
{
"RestApiId": {
"Ref": "ServerlessRestApi"
},
"StageName": {
"Ref": "ServerlessRestApiProdStage"
}
}
]
}
},
"LinkHeartInHandKey": {
"Type": "AWS::ApiGateway::UsagePlanKey",
"Properties": {
"KeyId": {
"Ref": "APIGatewayHeartInHandKey"
},
"KeyType": "API_KEY",
"UsagePlanId": {
"Ref": "APIGatewayUsagePlanInternal"
}
}
},
"APIGatewayPricelineSiteKey": {
"Type": "AWS::ApiGateway::ApiKey",
"DependsOn": [
"ServerlessRestApi",
"ServerlessRestApiProdStage"
],
"Properties": {
"Name": "PricelineSiteApiKey",
"Description": "Api Key for Priceline Website",
"Enabled": true,
"GenerateDistinctId": true,
"StageKeys": [
{
"RestApiId": {
"Ref": "ServerlessRestApi"
},
"StageName": {
"Ref": "ServerlessRestApiProdStage"
}
}
]
}
},
"LinkPricelineSiteKey": {
"Type": "AWS::ApiGateway::UsagePlanKey",
"Properties": {
"KeyId": {
"Ref": "APIGatewayPricelineSiteKey"
},
"KeyType": "API_KEY",
"UsagePlanId": {
"Ref": "APIGatewayUsagePlanInternal"
}
}
}
},
"Outputs": {
"ApiURL": {
"Description": "API endpoint URL for Prod environment",
"Value": {
"Fn::Sub": "https://${ServerlessRestApi}.execute-api.${AWS::Region}.amazonaws.com/Prod/"
}
}
}
}
it looks like you're trying to use features of the AWS::Serverless::Api resource from SAM without defining an AWS::Serverless::Api in your template.
In order to fix the issues you've brought up, it looks like you need to:
Remove the ServerlessRestApiProdStage resource
Sam will generate this resource (and the deployment resource) for you if you use an AWS::Serverless::Api resource.
Convert your AWS::ApiGateway::RestApi resource into an AWS::Serverless::Api resource:
Remove ApiKeySourceType property and add "x-amazon-apigateway-api-key-source" : "HEADER", to the swagger,
Change the Type from AWS::ApiGateway::RestApi to AWS::Serverless::Api
"ServerlessRestApi": {
"Type": "AWS::Serverless::RestApi",
"Properties": {
"Description":"This is a placeholder for the description of this web api",
"Body": {
"info": {
"version": "1.0",
"title": {
"Ref": "AWS::StackName"
}
},
"x-amazon-apigateway-api-key-source" : "HEADER",
"paths": {
...
Find below my json data and suggest me how to print the tld using foreach loop in laravel. Suggest me how to declare this array structure using foreach loop.
{
"result": "success",
"currency": {
"id": "1",
"code": "INR",
"prefix": " \u20b9",
"suffix": "INR",
"format": "1",
"rate": "1.00000"
},
"pricing": {
"in": {
"categories": [
"ccTLD",
"Geography"
],
"addons": {
"dns": true,
"email": true,
"idprotect": true
},
"group": "",
"register": {
"1": "704.39"
},
"transfer": {
"1": "704.39"
},
"renew": {
"1": "704.39"
}
},
"in.net": {
"categories": [
"Other"
],
"addons": {
"dns": true,
"email": true,
"idprotect": true
},
"group": "",
"register": {
"1": "547.69"
},
"transfer": {
"1": "547.69"
},
"renew": {
"1": "547.69"
}
},
"info": {
"categories": [
"gTLD",
"Popular"
],
"addons": {
"dns": true,
"email": true,
"idprotect": true
},
"group": "",
"register": {
"1": "861.10"
},
"transfer": {
"1": "861.10"
},
"renew": {
"1": "861.10"
}
},
"org": {
"categories": [
"gTLD",
"Popular"
],
"addons": {
"dns": true,
"email": true,
"idprotect": true
},
"group": "",
"register": {
"1": "939.45"
},
"transfer": {
"1": "939.45"
},
"renew": {
"1": "939.45"
}
},
"com": {
"categories": [
"gTLD",
"Popular"
],
"addons": {
"dns": true,
"email": true,
"idprotect": true
},
"group": "",
"register": {
"1": "740.43"
},
"transfer": {
"1": "740.43"
},
"renew": {
"1": "740.43"
}
},
"net": {
"categories": [
"gTLD",
"Popular"
],
"addons": {
"dns": true,
"email": true,
"idprotect": true
},
"group": "",
"register": {
"1": "829.76"
},
"transfer": {
"1": "829.76"
},
"renew": {
"1": "829.76"
}
},
"biz": {
"categories": [
"gTLD",
"Popular"
],
"addons": {
"dns": true,
"email": true,
"idprotect": true
},
"group": "",
"register": {
"1": "878.33"
},
"transfer": {
"1": "878.33"
},
"renew": {
"1": "878.33"
}
}
}
}
From the above data I wanted to display the tlds such as in,in.net,org,info,com,net,biz.
Use this:
$tlds = array_keys(json_decode($json, true)['pricing']);