I have JSON below which I get as result of Resource Graph Query, I just need return only instances where properties.policyAssessmentsSummaries.policyName == "Monitoring agent health issues should be resolved on your machines"
How can I do it in query?
{
"name": "GenericSecurityStatusesSummary",
"resourceHealthSummryPerCategory": [
{
"category": "Compute",
"healthy": 9,
"medium": 287,
"high": 337,
"none": null,
"low": 143
},
{
"category": "Networking",
"healthy": 754,
"medium": null,
"high": 10,
"none": 12,
"low": null
}
],
"policyAssessmentsSummaries": [
{
"policyDefinitionId": null,
"assessmentKey": "d1db3318-01ff-16de-29eb-28b344515626",
"policyName": "Monitoring agent should be installed on your machines",
"category": "Compute",
"healthy": 776,
"medium": null,
"high": null,
"none": null,
"low": null
},
{
"policyDefinitionId": null,
"assessmentKey": "8e2b96ff-3de2-289b-b5c1-3b9921a3441e",
"policyName": "Monitoring agent health issues should be resolved on your machines",
"category": "Compute",
"healthy": 676,
"medium": 100,
"high": null,
"none": null,
"low": null
},
{
"policyDefinitionId": null,
"assessmentKey": "83f577bd-a1b6-b7e1-0891-12ca19d1e6df",
"policyName": "Install endpoint protection solution on your machines",
"category": "Compute",
"healthy": 496,
"medium": null,
"high": 71,
"none": 209,
"low": null
},
{
"policyDefinitionId": null,
"assessmentKey": "3bcd234d-c9c7-c2a2-89e0-c01f419c1a8a",
"policyName": "Endpoint protection health issues should be resolved on your machines",
"category": "Compute",
"healthy": 488,
"medium": 2,
"high": 6,
"none": 280,
"low": null
},
{
"policyDefinitionId": null,
"assessmentKey": "181ac480-f7c4-544b-9865-11b8ffe87f47",
"policyName": "Vulnerabilities in security configuration on your machines should be remediated",
"category": "Compute",
"healthy": null,
"medium": null,
"high": null,
"none": 136,
"low": 640
},
{
"policyDefinitionId": null,
"assessmentKey": "c0f5316d-5ac5-9218-b77a-b96e16ccfd66",
"policyName": "Your machines should be restarted to apply system updates",
"category": "Compute",
"healthy": 629,
"medium": 17,
"high": null,
"none": 130,
"low": null
},
{
"policyDefinitionId": null,
"assessmentKey": "4ab6e3c5-74dd-8b35-9ab9-f61b30875b27",
"policyName": "System updates should be installed on your machines",
"category": "Compute",
"healthy": 572,
"medium": null,
"high": 24,
"none": 130,
"low": 50
},
{
"policyDefinitionId": null,
"assessmentKey": "d57a4221-a804-52ca-3dea-768284f06bb7",
"policyName": "Disk encryption should be applied on virtual machines",
"category": "Compute",
"healthy": null,
"medium": null,
"high": 272,
"none": 504,
"low": null
},
{
"policyDefinitionId": null,
"assessmentKey": "f9f0eed0-f143-47bf-b856-671ea2eeed62",
"policyName": "Harden Network Security Group rules of internet facing virtual machines",
"category": "Networking",
"healthy": null,
"medium": null,
"high": null,
"none": 776,
"low": null
},
{
"policyDefinitionId": null,
"assessmentKey": "35f45c95-27cf-4e52-891f-8390d1de5828",
"policyName": "Adaptive Application Controls should be enabled on virtual machines",
"category": "Compute",
"healthy": null,
"medium": null,
"high": null,
"none": 776,
"low": null
},
{
"policyDefinitionId": null,
"assessmentKey": "01b1ed4c-b733-4fee-b145-f23236e70cf3",
"policyName": "Vulnerability assessment solution should be installed on your virtual machines",
"category": "Compute",
"healthy": null,
"medium": 522,
"high": null,
"none": 254,
"low": null
},
{
"policyDefinitionId": null,
"assessmentKey": "71992a2a-d168-42e0-b10e-6b45fa2ecddb",
"policyName": "Vulnerabilities should be remediated by a Vulnerability Assessment solution",
"category": "Compute",
"healthy": null,
"medium": null,
"high": null,
"none": 776,
"low": null
},
{
"policyDefinitionId": null,
"assessmentKey": "3b20e985-f71f-483b-b078-f30d73936d43",
"policyName": "Access should be restricted for permissive Network Security Groups with Internet-facing VMs",
"category": "Networking",
"healthy": 755,
"medium": null,
"high": 9,
"none": 12,
"low": null
},
{
"policyDefinitionId": null,
"assessmentKey": "0f50c962-6277-4142-8f95-aa16e80f8da4",
"policyName": "The rules for web applications on IaaS NSGs should be hardened",
"category": "Networking",
"healthy": 760,
"medium": null,
"high": 4,
"none": 12,
"low": null
},
{
"policyDefinitionId": null,
"assessmentKey": "bc303248-3d14-44c2-96a0-55f5c326b5fe",
"policyName": "Management ports should be closed on your virtual machines",
"category": "Networking",
"healthy": 761,
"medium": null,
"high": 3,
"none": 12,
"low": null
},
{
"policyDefinitionId": null,
"assessmentKey": "c3b51c94-588b-426b-a892-24696f9e54cc",
"policyName": "IP forwarding on your virtual machine should be disabled",
"category": "Networking",
"healthy": 764,
"medium": null,
"high": null,
"none": 12,
"low": null
},
{
"policyDefinitionId": null,
"assessmentKey": "805651bc-6ecd-4c73-9b55-97a19d0582d0",
"policyName": "Just-In-Time network access control should be applied on virtual machines",
"category": "Networking",
"healthy": null,
"medium": null,
"high": null,
"none": 776,
"low": null
}
],
"resourceHealthSummary": {
"healthy": 9,
"medium": 284,
"high": 340,
"none": null,
"low": 143
},
"resourceCount": 776
}
you could try using mv-expand or mv-apply. for example:
print d = dynamic({
"name": "GenericSecurityStatusesSummary",
"resourceHealthSummryPerCategory": [
{
"category": "Compute",
"healthy": 9,
"medium": 287,
"high": 337,
"none": null,
"low": 143
},
{
"category": "Networking",
"healthy": 754,
"medium": null,
"high": 10,
"none": 12,
"low": null
}
],
"policyAssessmentsSummaries": [
{
"policyDefinitionId": null,
"assessmentKey": "d1db3318-01ff-16de-29eb-28b344515626",
"policyName": "Monitoring agent should be installed on your machines",
"category": "Compute",
"healthy": 776,
"medium": null,
"high": null,
"none": null,
"low": null
},
{
"policyDefinitionId": null,
"assessmentKey": "8e2b96ff-3de2-289b-b5c1-3b9921a3441e",
"policyName": "Monitoring agent health issues should be resolved on your machines",
"category": "Compute",
"healthy": 676,
"medium": 100,
"high": null,
"none": null,
"low": null
},
{
"policyDefinitionId": null,
"assessmentKey": "83f577bd-a1b6-b7e1-0891-12ca19d1e6df",
"policyName": "Install endpoint protection solution on your machines",
"category": "Compute",
"healthy": 496,
"medium": null,
"high": 71,
"none": 209,
"low": null
},
{
"policyDefinitionId": null,
"assessmentKey": "3bcd234d-c9c7-c2a2-89e0-c01f419c1a8a",
"policyName": "Endpoint protection health issues should be resolved on your machines",
"category": "Compute",
"healthy": 488,
"medium": 2,
"high": 6,
"none": 280,
"low": null
},
{
"policyDefinitionId": null,
"assessmentKey": "181ac480-f7c4-544b-9865-11b8ffe87f47",
"policyName": "Vulnerabilities in security configuration on your machines should be remediated",
"category": "Compute",
"healthy": null,
"medium": null,
"high": null,
"none": 136,
"low": 640
},
{
"policyDefinitionId": null,
"assessmentKey": "c0f5316d-5ac5-9218-b77a-b96e16ccfd66",
"policyName": "Your machines should be restarted to apply system updates",
"category": "Compute",
"healthy": 629,
"medium": 17,
"high": null,
"none": 130,
"low": null
},
{
"policyDefinitionId": null,
"assessmentKey": "4ab6e3c5-74dd-8b35-9ab9-f61b30875b27",
"policyName": "System updates should be installed on your machines",
"category": "Compute",
"healthy": 572,
"medium": null,
"high": 24,
"none": 130,
"low": 50
},
{
"policyDefinitionId": null,
"assessmentKey": "d57a4221-a804-52ca-3dea-768284f06bb7",
"policyName": "Disk encryption should be applied on virtual machines",
"category": "Compute",
"healthy": null,
"medium": null,
"high": 272,
"none": 504,
"low": null
},
{
"policyDefinitionId": null,
"assessmentKey": "f9f0eed0-f143-47bf-b856-671ea2eeed62",
"policyName": "Harden Network Security Group rules of internet facing virtual machines",
"category": "Networking",
"healthy": null,
"medium": null,
"high": null,
"none": 776,
"low": null
},
{
"policyDefinitionId": null,
"assessmentKey": "35f45c95-27cf-4e52-891f-8390d1de5828",
"policyName": "Adaptive Application Controls should be enabled on virtual machines",
"category": "Compute",
"healthy": null,
"medium": null,
"high": null,
"none": 776,
"low": null
},
{
"policyDefinitionId": null,
"assessmentKey": "01b1ed4c-b733-4fee-b145-f23236e70cf3",
"policyName": "Vulnerability assessment solution should be installed on your virtual machines",
"category": "Compute",
"healthy": null,
"medium": 522,
"high": null,
"none": 254,
"low": null
},
{
"policyDefinitionId": null,
"assessmentKey": "71992a2a-d168-42e0-b10e-6b45fa2ecddb",
"policyName": "Vulnerabilities should be remediated by a Vulnerability Assessment solution",
"category": "Compute",
"healthy": null,
"medium": null,
"high": null,
"none": 776,
"low": null
},
{
"policyDefinitionId": null,
"assessmentKey": "3b20e985-f71f-483b-b078-f30d73936d43",
"policyName": "Access should be restricted for permissive Network Security Groups with Internet-facing VMs",
"category": "Networking",
"healthy": 755,
"medium": null,
"high": 9,
"none": 12,
"low": null
},
{
"policyDefinitionId": null,
"assessmentKey": "0f50c962-6277-4142-8f95-aa16e80f8da4",
"policyName": "The rules for web applications on IaaS NSGs should be hardened",
"category": "Networking",
"healthy": 760,
"medium": null,
"high": 4,
"none": 12,
"low": null
},
{
"policyDefinitionId": null,
"assessmentKey": "bc303248-3d14-44c2-96a0-55f5c326b5fe",
"policyName": "Management ports should be closed on your virtual machines",
"category": "Networking",
"healthy": 761,
"medium": null,
"high": 3,
"none": 12,
"low": null
},
{
"policyDefinitionId": null,
"assessmentKey": "c3b51c94-588b-426b-a892-24696f9e54cc",
"policyName": "IP forwarding on your virtual machine should be disabled",
"category": "Networking",
"healthy": 764,
"medium": null,
"high": null,
"none": 12,
"low": null
},
{
"policyDefinitionId": null,
"assessmentKey": "805651bc-6ecd-4c73-9b55-97a19d0582d0",
"policyName": "Just-In-Time network access control should be applied on virtual machines",
"category": "Networking",
"healthy": null,
"medium": null,
"high": null,
"none": 776,
"low": null
}
],
"resourceHealthSummary": {
"healthy": 9,
"medium": 284,
"high": 340,
"none": null,
"low": 143
},
"resourceCount": 776
})
| mv-apply d.policyAssessmentsSummaries on
(
where d_policyAssessmentsSummaries.policyName == "Monitoring agent health issues should be resolved on your machines"
)
or, using
...
| mv-expand d.policyAssessmentsSummaries
| where d_policyAssessmentsSummaries.policyName == "Monitoring agent health issues should be resolved on your machines"
Related
I am using the experimental app version of Nextjs 13.
My next.config.js looks like this:
/** #type {import('next').NextConfig} */
const nextConfig = {
experimental: {
appDir: true,
},
images: {
remotePatterns: [
{
protocol: 'http',
hostname: '127.0.0.1',
port: '1337',
pathname: '/api/**',
},
],
},
};
module.exports = nextConfig;
I make the following call to display an image on the screen:
<Image className='mt-2'
src={movie.data.attributes.image.data.attributes.url}
alt={movie.data.attributes.title}
width={500}
height={350}
/>
</div>
On the server side I am getting the following response:
The requested resource isn't a valid image for /uploads/2008_Jaden_3c49c0fe45.jpg received text/html; charset=utf-8
The image name is correct. And the title displayed is also correct.
It seems that the system is still pointing to the local folder /uploads instead of to the remote host that I configured in the next.config.js file.
I have tried and changed many things but I am unable to display the images. Hopefully someone can help me out?
Robert
I am using the following version:
Next.js 13.1.6
React 18.0.27
And for my backend
Strapi 4.6.1
The Strapi API route looks like this:
// 20230217152302
// http://127.0.0.1:1337/api/movies?populate=*
{
"data": [
{
"id": 1,
"attributes": {
"createdAt": "2023-02-03T15:39:55.796Z",
"updatedAt": "2023-02-07T11:39:47.652Z",
"publishedAt": "2023-02-03T15:40:08.569Z",
"title": "Lord of the Rings",
"year": 2001,
"description": "A meek Hobbit from the Shire and eight companions set out on a journey to destroy the powerful One Ring and save Middle-earth from the Dark Lord Sauron",
"slug": "lord-of-the-rings",
"image": {
"data": {
"id": 3,
"attributes": {
"name": "6FDUBGB.jpg",
"alternativeText": null,
"caption": null,
"width": 2000,
"height": 2496,
"formats": {
"thumbnail": {
"name": "thumbnail_6FDUBGB.jpg",
"hash": "thumbnail_6_FDUBGB_f8b45dbbae",
"ext": ".jpg",
"mime": "image/jpeg",
"path": null,
"width": 125,
"height": 156,
"size": 8.49,
"url": "/uploads/thumbnail_6_FDUBGB_f8b45dbbae.jpg"
},
"small": {
"name": "small_6FDUBGB.jpg",
"hash": "small_6_FDUBGB_f8b45dbbae",
"ext": ".jpg",
"mime": "image/jpeg",
"path": null,
"width": 401,
"height": 500,
"size": 62.75,
"url": "/uploads/small_6_FDUBGB_f8b45dbbae.jpg"
},
"medium": {
"name": "medium_6FDUBGB.jpg",
"hash": "medium_6_FDUBGB_f8b45dbbae",
"ext": ".jpg",
"mime": "image/jpeg",
"path": null,
"width": 601,
"height": 750,
"size": 117.55,
"url": "/uploads/medium_6_FDUBGB_f8b45dbbae.jpg"
},
"large": {
"name": "large_6FDUBGB.jpg",
"hash": "large_6_FDUBGB_f8b45dbbae",
"ext": ".jpg",
"mime": "image/jpeg",
"path": null,
"width": 801,
"height": 1000,
"size": 182.81,
"url": "/uploads/large_6_FDUBGB_f8b45dbbae.jpg"
}
},
"hash": "6_FDUBGB_f8b45dbbae",
"ext": ".jpg",
"mime": "image/jpeg",
"size": 597.08,
"url": "/uploads/6_FDUBGB_f8b45dbbae.jpg",
"previewUrl": null,
"provider": "local",
"provider_metadata": null,
"createdAt": "2023-02-07T11:39:40.120Z",
"updatedAt": "2023-02-07T11:39:40.120Z"
}
}
}
}
},
{
"id": 2,
"attributes": {
"createdAt": "2023-02-03T15:42:51.349Z",
"updatedAt": "2023-02-07T11:40:12.979Z",
"publishedAt": "2023-02-03T15:42:52.112Z",
"title": "Star Wars",
"year": 1977,
"description": "Luke Skywalker joins forces with a Jedi Knight, a cocky pilot, a Wookiee and two droide to save the galaxy from the Empire's wold-destroying battle station, while also attemting te rescue Princess Leia from the mysterious Darth Vader.",
"slug": "star-wars",
"image": {
"data": {
"id": 4,
"attributes": {
"name": "2008 Jaden.jpg",
"alternativeText": null,
"caption": null,
"width": 1868,
"height": 1304,
"formats": {
"thumbnail": {
"name": "thumbnail_2008 Jaden.jpg",
"hash": "thumbnail_2008_Jaden_3c49c0fe45",
"ext": ".jpg",
"mime": "image/jpeg",
"path": null,
"width": 223,
"height": 156,
"size": 9.92,
"url": "/uploads/thumbnail_2008_Jaden_3c49c0fe45.jpg"
},
"small": {
"name": "small_2008 Jaden.jpg",
"hash": "small_2008_Jaden_3c49c0fe45",
"ext": ".jpg",
"mime": "image/jpeg",
"path": null,
"width": 500,
"height": 349,
"size": 35.21,
"url": "/uploads/small_2008_Jaden_3c49c0fe45.jpg"
},
"medium": {
"name": "medium_2008 Jaden.jpg",
"hash": "medium_2008_Jaden_3c49c0fe45",
"ext": ".jpg",
"mime": "image/jpeg",
"path": null,
"width": 750,
"height": 524,
"size": 65.83,
"url": "/uploads/medium_2008_Jaden_3c49c0fe45.jpg"
},
"large": {
"name": "large_2008 Jaden.jpg",
"hash": "large_2008_Jaden_3c49c0fe45",
"ext": ".jpg",
"mime": "image/jpeg",
"path": null,
"width": 1000,
"height": 698,
"size": 102.08,
"url": "/uploads/large_2008_Jaden_3c49c0fe45.jpg"
}
},
"hash": "2008_Jaden_3c49c0fe45",
"ext": ".jpg",
"mime": "image/jpeg",
"size": 258.7,
"url": "/uploads/2008_Jaden_3c49c0fe45.jpg",
"previewUrl": null,
"provider": "local",
"provider_metadata": null,
"createdAt": "2023-02-07T11:40:06.583Z",
"updatedAt": "2023-02-07T11:40:06.583Z"
}
}
}
}
}
],
"meta": {
"pagination": {
"page": 1,
"pageSize": 25,
"pageCount": 1,
"total": 2
}
}
}
How can I get the image stored in Strapi 4.6 displayed on the screen with nextjs 13:
export default function Page({ params }) {
let movie = use(getMovie(params.movieID));
console.log("Movie This is the text", movie);
//console.log(params.movieID);
//console.log("Database output !!!", movie.${params.movieID}.?populate=*);
//const API_URL = ('http://127.0.0.1:1337');
return (
<div>
<p className="text-3xl">{movie.data.attributes.title}</p>
<p className="mt-2">Year: {movie.data.attributes.year}</p>
<p className="mt-2">Description: {movie.data.attributes.description}</p>
<Image className='mt-2'
src={movie.data.attributes.image.data.attributes.url}
alt={movie.data.attributes.title}
width={500}
height={349}
/>
</div>
);
}
The Title, year, and description of the movie are fixable on the screen.
On de server side I am receiving the following error:
event - compiled client and server successfully in 145 ms (545 modules)
The requested resource isn't a valid image for /uploads/2008_Jaden_3c49c0fe45.jpg received text/html; charset=utf-8
The settings of my next.config.js file are:
/** #type {import('next').NextConfig} */
const nextConfig = {
experimental: {
appDir: true,
},
images: {
remotePatterns: [
{
protocol: "http",
hostname: "127.0.0.1",
port: "1337",
pathname: "/**",
},
],
},
};
module.exports = nextConfig;
Strapi 4.6 return the following API:
// 20230217152302
// http://127.0.0.1:1337/api/movies?populate=*
{
"data": [
{
"id": 1,
"attributes": {
"createdAt": "2023-02-03T15:39:55.796Z",
"updatedAt": "2023-02-07T11:39:47.652Z",
"publishedAt": "2023-02-03T15:40:08.569Z",
"title": "Lord of the Rings",
"year": 2001,
"description": "A meek Hobbit from the Shire and eight companions set out on a journey to destroy the powerful One Ring and save Middle-earth from the Dark Lord Sauron",
"slug": "lord-of-the-rings",
"image": {
"data": {
"id": 3,
"attributes": {
"name": "6FDUBGB.jpg",
"alternativeText": null,
"caption": null,
"width": 2000,
"height": 2496,
"formats": {
"thumbnail": {
"name": "thumbnail_6FDUBGB.jpg",
"hash": "thumbnail_6_FDUBGB_f8b45dbbae",
"ext": ".jpg",
"mime": "image/jpeg",
"path": null,
"width": 125,
"height": 156,
"size": 8.49,
"url": "/uploads/thumbnail_6_FDUBGB_f8b45dbbae.jpg"
},
"small": {
"name": "small_6FDUBGB.jpg",
"hash": "small_6_FDUBGB_f8b45dbbae",
"ext": ".jpg",
"mime": "image/jpeg",
"path": null,
"width": 401,
"height": 500,
"size": 62.75,
"url": "/uploads/small_6_FDUBGB_f8b45dbbae.jpg"
},
"medium": {
"name": "medium_6FDUBGB.jpg",
"hash": "medium_6_FDUBGB_f8b45dbbae",
"ext": ".jpg",
"mime": "image/jpeg",
"path": null,
"width": 601,
"height": 750,
"size": 117.55,
"url": "/uploads/medium_6_FDUBGB_f8b45dbbae.jpg"
},
"large": {
"name": "large_6FDUBGB.jpg",
"hash": "large_6_FDUBGB_f8b45dbbae",
"ext": ".jpg",
"mime": "image/jpeg",
"path": null,
"width": 801,
"height": 1000,
"size": 182.81,
"url": "/uploads/large_6_FDUBGB_f8b45dbbae.jpg"
}
},
"hash": "6_FDUBGB_f8b45dbbae",
"ext": ".jpg",
"mime": "image/jpeg",
"size": 597.08,
"url": "/uploads/6_FDUBGB_f8b45dbbae.jpg",
"previewUrl": null,
"provider": "local",
"provider_metadata": null,
"createdAt": "2023-02-07T11:39:40.120Z",
"updatedAt": "2023-02-07T11:39:40.120Z"
}
}
}
}
},
{
"id": 2,
"attributes": {
"createdAt": "2023-02-03T15:42:51.349Z",
"updatedAt": "2023-02-07T11:40:12.979Z",
"publishedAt": "2023-02-03T15:42:52.112Z",
"title": "Star Wars",
"year": 1977,
"description": "Luke Skywalker joins forces with a Jedi Knight, a cocky pilot, a Wookiee and two droide to save the galaxy from the Empire's wold-destroying battle station, while also attemting te rescue Princess Leia from the mysterious Darth Vader.",
"slug": "star-wars",
"image": {
"data": {
"id": 4,
"attributes": {
"name": "2008 Jaden.jpg",
"alternativeText": null,
"caption": null,
"width": 1868,
"height": 1304,
"formats": {
"thumbnail": {
"name": "thumbnail_2008 Jaden.jpg",
"hash": "thumbnail_2008_Jaden_3c49c0fe45",
"ext": ".jpg",
"mime": "image/jpeg",
"path": null,
"width": 223,
"height": 156,
"size": 9.92,
"url": "/uploads/thumbnail_2008_Jaden_3c49c0fe45.jpg"
},
"small": {
"name": "small_2008 Jaden.jpg",
"hash": "small_2008_Jaden_3c49c0fe45",
"ext": ".jpg",
"mime": "image/jpeg",
"path": null,
"width": 500,
"height": 349,
"size": 35.21,
"url": "/uploads/small_2008_Jaden_3c49c0fe45.jpg"
},
"medium": {
"name": "medium_2008 Jaden.jpg",
"hash": "medium_2008_Jaden_3c49c0fe45",
"ext": ".jpg",
"mime": "image/jpeg",
"path": null,
"width": 750,
"height": 524,
"size": 65.83,
"url": "/uploads/medium_2008_Jaden_3c49c0fe45.jpg"
},
"large": {
"name": "large_2008 Jaden.jpg",
"hash": "large_2008_Jaden_3c49c0fe45",
"ext": ".jpg",
"mime": "image/jpeg",
"path": null,
"width": 1000,
"height": 698,
"size": 102.08,
"url": "/uploads/large_2008_Jaden_3c49c0fe45.jpg"
}
},
"hash": "2008_Jaden_3c49c0fe45",
"ext": ".jpg",
"mime": "image/jpeg",
"size": 258.7,
"url": "/uploads/2008_Jaden_3c49c0fe45.jpg",
"previewUrl": null,
"provider": "local",
"provider_metadata": null,
"createdAt": "2023-02-07T11:40:06.583Z",
"updatedAt": "2023-02-07T11:40:06.583Z"
}
}
}
}
}
],
"meta": {
"pagination": {
"page": 1,
"pageSize": 25,
"pageCount": 1,
"total": 2
}
}
}
Hopefully someone can help me out?
Thanks on forehand for your help!
Robert
Strapi only returns the relative paths of your images (or media in general). You need to prepend those paths with the URL/domain on which your Strapi is hosted.
E.g:
"http://127.0.0.1:1337" + "/uploads/2008_Jaden_3c49c0fe45.jpg"
"https://my-hosted-strapi.com" + "/uploads/2008_Jaden_3c49c0fe45.jpg"
After running
firebase deploy --only functions
I get this Build Error:
{
"metrics": {},
"error": {
"buildpackId": "",
"buildpackVersion": "",
"errorType": "OK",
"canonicalCode": "OK",
"errorId": "",
"errorMessage": ""
},
"stats": [
{
"buildpackId": "google.nodejs.runtime",
"buildpackVersion": "1.0.0",
"totalDurationMs": 1311,
"userDurationMs": 0
},
{
"buildpackId": "google.utils.archive-source",
"buildpackVersion": "0.0.1",
"totalDurationMs": 633,
"userDurationMs": 632
},
{
"buildpackId": "google.nodejs.npm",
"buildpackVersion": "1.0.0",
"totalDurationMs": 16330,
"userDurationMs": 15831
},
{
"buildpackId": "google.nodejs.functions-framework",
"buildpackVersion": "0.9.4",
"totalDurationMs": 8410,
"userDurationMs": 7989
},
{
"buildpackId": "google.config.entrypoint",
"buildpackVersion": "0.9.0",
"totalDurationMs": 0,
"userDurationMs": 0
},
{
"buildpackId": "google.utils.label",
"buildpackVersion": "0.0.2",
"totalDurationMs": 0,
"userDurationMs": 0
}
],
"warnings": null,
"customImage": false
}
How to tackle this? There seams no information anywhere, what is going wrong.
Update: When I try deploying a single function it works about one of ten times.
Update: Sometimes, instead of the Build Error, I get Invalid Source Token. No changes to the code. Just another try to deploy:
{
"protoPayload": {
"#type": "type.googleapis.com/google.cloud.audit.AuditLog",
"status": {
"code": 9,
"message": "Invalid source token"
},
"authenticationInfo": {
"principalEmail": "witoslaw.koczewski#gmail.com"
},
"serviceName": "cloudfunctions.googleapis.com",
"methodName": "google.cloud.functions.v1.CloudFunctionsService.UpdateFunction",
"resourceName": "projects/happygast/locations/europe-west1/functions/onWriteBenutzer"
},
"insertId": "-tykpquc6n0",
"resource": {
"type": "cloud_function",
"labels": {
"project_id": "happygast",
"region": "europe-west1",
"function_name": "onWriteBenutzer"
}
},
"timestamp": "2022-09-27T18:40:55.742542Z",
"severity": "ERROR",
"logName": "projects/happygast/logs/cloudaudit.googleapis.com%2Factivity",
"operation": {
"id": "operations/aGFwcHlnYXN0L2V1cm9wZS13ZXN0MS9vbldyaXRlQmVudXR6ZXIvWUFWMXpjUEpsYk0",
"producer": "cloudfunctions.googleapis.com",
"last": true
},
"receiveTimestamp": "2022-09-27T18:40:56.281792834Z"
}
Update: A day later the problem was gone. It seams, this was a temporary issue in the cloud.
Per the documentation:
Optionally, some linked resources may be included in the response to
reduce the number of HTTP requests required. These resources are
“embedded” into the main response.
Embedding is triggered by setting the _embed query parameter on the
request. This will then include embedded resources under the _embedded
key adjacent to the _links key. The layout of this object mirrors the
_links object, but includes the embedded resource in place of the link
properties.
Despite this, when I make the following GET request:
http://anawins.com/wp-json/wp/v2/posts/2986?_embed
The resulting JSON is identical the request without ?_embed.
With embed:
{
"id": 2986,
"date": "2016-05-09T03:00:42",
"date_gmt": "2016-05-09T07:00:42",
"guid": {
"rendered": "http:\/\/anawins.com\/?p=2986"
},
"modified": "2016-05-08T16:37:39",
"modified_gmt": "2016-05-08T20:37:39",
"slug": "the-secret-to-speaking-with-more-grace",
"type": "post",
"link": "http:\/\/anawins.com\/the-secret-to-speaking-with-more-grace\/",
"title": {
"rendered": "The Secret to Speaking With Grace"
},
"content": {
"rendered": "<p><img class=\"aligncenter size-large wp-image-3474\" src=\"http:\/\/anawins.com\/wp-content\/uploads\/2016\/05\/the-secret-to-speaking-with-grace-367x550.png\" alt=\"Do you...."
},
"excerpt": {
"rendered": "<p>I have a little..."
},
"author": 2,
"featured_media": 0,
"comment_status": "open",
"ping_status": "open",
"sticky": false,
"format": "standard",
"categories": [193, 58],
"tags": [110, 194, 206, 205, 204],
"better_featured_image": null,
"_links": {
"self": [{
"href": "http:\/\/anawins.com\/wp-json\/wp\/v2\/posts\/2986"
}],
"collection": [{
"href": "http:\/\/anawins.com\/wp-json\/wp\/v2\/posts"
}],
"about": [{
"href": "http:\/\/anawins.com\/wp-json\/wp\/v2\/types\/post"
}],
"author": [{
"embeddable": true,
"href": "http:\/\/anawins.com\/wp-json\/wp\/v2\/users\/2"
}],
"replies": [{
"embeddable": true,
"href": "http:\/\/anawins.com\/wp-json\/wp\/v2\/comments?post=2986"
}],
"version-history": [{
"href": "http:\/\/anawins.com\/wp-json\/wp\/v2\/posts\/2986\/revisions"
}],
"wp:attachment": [{
"href": "http:\/\/anawins.com\/wp-json\/wp\/v2\/media?parent=2986"
}],
"wp:term": [{
"taxonomy": "category",
"embeddable": true,
"href": "http:\/\/anawins.com\/wp-json\/wp\/v2\/categories?post=2986"
}, {
"taxonomy": "post_tag",
"embeddable": true,
"href": "http:\/\/anawins.com\/wp-json\/wp\/v2\/tags?post=2986"
}],
"curies": [{
"name": "wp",
"href": "https:\/\/api.w.org\/{rel}",
"templated": true
}]
}
}
Without _embed:
{
"id": 2986,
"date": "2016-05-09T03:00:42",
"date_gmt": "2016-05-09T07:00:42",
"guid": {
"rendered": "http:\/\/anawins.com\/?p=2986"
},
"modified": "2016-05-08T16:37:39",
"modified_gmt": "2016-05-08T20:37:39",
"slug": "the-secret-to-speaking-with-more-grace",
"type": "post",
"link": "http:\/\/anawins.com\/the-secret-to-speaking-with-more-grace\/",
"title": {
"rendered": "The Secret to Speaking With Grace"
},
"content": {
"rendered": "<p><img class=\"aligncenter size-large wp-image-3474\" src=\"http:\/\/anawins.com\/wp-content\/uploads\/2016\/05\/the-secret-to-speaking-with-grace-367x550.png\" alt=\"Do you struggle..."
},
"excerpt": {
"rendered": "<p>I have a little..."
},
"author": 2,
"featured_media": 0,
"comment_status": "open",
"ping_status": "open",
"sticky": false,
"format": "standard",
"categories": [193, 58],
"tags": [110, 194, 206, 205, 204],
"better_featured_image": null,
"_links": {
"self": [{
"href": "http:\/\/anawins.com\/wp-json\/wp\/v2\/posts\/2986"
}],
"collection": [{
"href": "http:\/\/anawins.com\/wp-json\/wp\/v2\/posts"
}],
"about": [{
"href": "http:\/\/anawins.com\/wp-json\/wp\/v2\/types\/post"
}],
"author": [{
"embeddable": true,
"href": "http:\/\/anawins.com\/wp-json\/wp\/v2\/users\/2"
}],
"replies": [{
"embeddable": true,
"href": "http:\/\/anawins.com\/wp-json\/wp\/v2\/comments?post=2986"
}],
"version-history": [{
"href": "http:\/\/anawins.com\/wp-json\/wp\/v2\/posts\/2986\/revisions"
}],
"wp:attachment": [{
"href": "http:\/\/anawins.com\/wp-json\/wp\/v2\/media?parent=2986"
}],
"wp:term": [{
"taxonomy": "category",
"embeddable": true,
"href": "http:\/\/anawins.com\/wp-json\/wp\/v2\/categories?post=2986"
}, {
"taxonomy": "post_tag",
"embeddable": true,
"href": "http:\/\/anawins.com\/wp-json\/wp\/v2\/tags?post=2986"
}],
"curies": [{
"name": "wp",
"href": "https:\/\/api.w.org\/{rel}",
"templated": true
}]
}
}
How do I change the query to make this work?
I have an application which needs to listen on ipv6 for a specific port. I have exposed it in the docker file, and I'm running the docker engine with DOCKER_OPTS="--ipv6", but I can't get docker to properly map the ports over ipv6.
Port shows up when using docker inspect {name} (see below for output - redacted to get rid of superfluous stuff). For some reason I can't get it to route the IPv6 stuff, however (and it looks like the ports are only being exposed as ipv4 from the output below).
How do I go about getting the port (9084) to be accessible via ipv6 connections to the host, in the same way that the other two ports are accessible over ipv4 connections to the host?
[
{
// [...]
"HostConfig": {
// [...]
"NetworkMode": "default",
"PortBindings": {
"8883/tcp": [
{
"HostIp": "0.0.0.0",
"HostPort": "8883"
}
],
"9084/tcp": [
{
"HostIp": "0.0.0.0",
"HostPort": "9084"
}
],
"9094/tcp": [
{
"HostIp": "0.0.0.0",
"HostPort": "9094"
}
]
},
// [...]
"Dns": [],
"DnsOptions": [],
"DnsSearch": [],
"ExtraHosts": null,
"GroupAdd": null,
"IpcMode": "",
"Cgroup": "",
"Links": null,
// [...]
},
// [...]
"Config": {
"Hostname": "40c7aa89b266",
"Domainname": "",
"User": "",
"AttachStdin": false,
"AttachStdout": false,
"AttachStderr": false,
"ExposedPorts": {
"8883/tcp": {},
"9084/tcp": {},
"9094/tcp": {}
},
// [...]
},
"NetworkSettings": {
"Bridge": "",
"SandboxID": "97923c78571e880f267b56f4d86a7338e2f7a878d20b9961ae208af9c2bc6b64",
"HairpinMode": false,
"LinkLocalIPv6Address": "",
"LinkLocalIPv6PrefixLen": 0,
"Ports": {
"8883/tcp": [
{
"HostIp": "0.0.0.0",
"HostPort": "8883"
}
],
"9084/tcp": [
{
"HostIp": "0.0.0.0",
"HostPort": "9084"
}
],
"9094/tcp": [
{
"HostIp": "0.0.0.0",
"HostPort": "9094"
}
]
},
"SandboxKey": "/var/run/docker/netns/97923c78571e",
"SecondaryIPAddresses": null,
"SecondaryIPv6Addresses": null,
"EndpointID": "cdddc3cd29e3cb40f68cf696f0d6dffadd08aa5bf256cd12cef180f04795ee83",
"Gateway": "172.17.0.1",
"GlobalIPv6Address": "fe80::242:ac11:4",
"GlobalIPv6PrefixLen": 64,
"IPAddress": "172.17.0.4",
"IPPrefixLen": 16,
"IPv6Gateway": "fe80::1",
"MacAddress": "02:42:ac:11:00:04",
"Networks": {
"bridge": {
"IPAMConfig": null,
"Links": null,
"Aliases": null,
"NetworkID": "3371009b227abe4e8992fbd9a56ea662ee76fd692b6d7080045d5deb055e29e3",
"EndpointID": "cdddc3cd29e3cb40f68cf696f0d6dffadd08aa5bf256cd12cef180f04795ee83",
"Gateway": "172.17.0.1",
"IPAddress": "172.17.0.4",
"IPPrefixLen": 16,
"IPv6Gateway": "fe80::1",
"GlobalIPv6Address": "fe80::242:ac11:4",
"GlobalIPv6PrefixLen": 64,
"MacAddress": "02:42:ac:11:00:04"
}
}
}
}
]