Invalid src prop in Next.js [duplicate] - javascript

This question already has answers here:
Error: Invalid src prop on `next/image`, hostname "res.cloudinary.com" is not configured under images in your `next.config.js`
(5 answers)
Closed 3 months ago.
Error: Invalid src prop (https://scontent-atl3-2.xx.fbcdn.net/v/t1.30497-1/c29.0.100.100a/p100x100/84628273_176159830277856_972693363922829312_n.jpg?_nc_cat=1&ccb=1-4&_nc_sid=12b3be&_nc_ohc=GsA3y-ZkuUoAX_VFkof&_nc_ht=scontent-atl3-2.xx&edm=AP4hL3IEAAAA&oh=19bbbd2923855115071affa90dc53b68&oe=6138E675) on next/image, hostname "scontent-atl3-2.xx.fbcdn.net" is not configured under images in your next.config.js
See more info: https://nextjs.org/docs/messages/next-image-unconfigured-host

All you need to is add to add the hostname in the error code to next.config.js
hostname "scontent-atl3-2.xx.fbcdn.net" is not configured under images in your next.config.js
Open your next.config.js, add the following under images.domains. Do this for any domain, mind you don't add 'www', 'http' or 'https'.
images: {
domains: ["scontent-atl3-2.xx.fbcdn.net"],
}

Possible Solution: Remove Bundle Analyzer
Howdy devs,
After painstaking hours of messing with this, the problem wasn't the domains: area of the next.config file, it was a problem created by adding the#next/bundle-analyzer to the App (this pkg).
I don't know exactly what made things break, but our App is running Next v12.2.3 and it's possible that the bundle analyzer and our version of Next weren't playing nicely together.
So, I removed it and this error went away.

Related

Error: File opened in Node.js JavaScript runtime [duplicate]

This question already has answers here:
where to destroy knex connection
(3 answers)
Closed 7 months ago.
I have some script on Node.js server.
It's opened some file, do something, and after that i try remove this file from storage with fs.unlink, but i got an error: EBUSY: resource busy or locked, unlink
If i try delete if manually, i got an error:
Screenshot with error
If i stop node.js app, or reload, error disappear, and i can delete this file.
How i can remove this file from Node.js JavaScript runtime, and remove it without error and crashes my app?
UPD:
I just parse .sqlite file trough knex.select("table_name")
And after that, fs.unlink() must remove that .sqlite file
Without seeing the code it's difficult to say, but surely your file is still open. Try fs.close(fd, callback) before fs.unlink. However, I'd think your bug has to do with asynchronously performed code.

Following Udemy course "Modern React with Redux". Very strange issues, if you can help me figure them out

First, as I follow the lectures, I deleted "src" folder entirely, but in the browser on the "localhost:8080" page content "Hello There!!!" from index.js file remained intact on the page after refreshing. First oddity.
Researched questions&answers for similar experiences -none. Asked Question 6 days ago, answer- none.
As I continued with the lectures, constructed new "src" folder and brand new "index.js" file. Inside of that file I wrote, following the tutor, an error-driven code which should produce an error in the console.
That code is:
const App = function() {
return <div> Hi! </div>
}
React.render(App);
The expected and never showed error should be:
Uncaught Reference Error react is not defined.
None. Just blank in the console. And the old "deleted" "Hey There!!!" content on the page.
EDIT 2:
When I import the React from 'react', now get a different error.
This error suggests that there is an application already using the Port 8080. This means that, if your app was running in the same port, then, you did not properly stop the server and as a result the app is still running there. You can fix this in one of two ways:
Make sure you have stopped the server completely with CTRL+C
Change the port your app is running in.
I would suggest the first option.

Phaser - I Can't start any example [duplicate]

This question already has answers here:
Understanding phaser in java with an example
(3 answers)
Closed 5 years ago.
I want to learn this framework ...
I download last version from github put it intro www folder and i don't see any working file .
Is it strict to use MAMP ?
Being a Unix environment at heart there are more options available on OS X than Windows. But if you'd like an "all in one" approach like WAMP, with a nice clean and easy to use interface, then we'd strongly recommend MAMP. This comes in two versions: one free and one paid for.
Logs :
projects/bomber/
Viewport argument key "minimal-ui" not recognized and ignored.
This folder should sit along-side the Phaser Examples, for example:
/webroot/phaser
/webroot/phaser-examples
I use relative path .
Error log from tree examples :
[Error] Failed to load resource: the server responded with a status of
404 (Not Found) (phaser.js, line 0)
localhost/new_prototype_slot/STARTER/phaser-examples-master/examples/_site/js/phaser.jsFailed
to load resource: the server responded with a status of 404 (Not
Found)
Any suggestion who to start example in localhost !
Download brackets.io text editor, open index.html file, then click "live preview" button?

Pimcore: Getting the White-Screen-of-Death after successful admin login

I've installed Pimcore on a VPS through Liquid Web. I loaded the sample data install which also uses the nightly build code. While everything installed fine, the public facing website appears fine and functions well, as does the login screen for the admin panel, once you log in, you see three black pulsing dots in the middle of a white screen, where eventually they disappear and you're simply left with a white screen.
Upon inspection of the error console, I'm seeing this error:
Failed to load resource: the server responded with a status of 404 (Not Found)
/website/var/tmp/minified_javascript_core_b18dd1d6984052da2ab5abc79f0c4a17.js?_dc=3704
Other scripts are also failing because this script isn't being loaded, so I'm fairly sure that once this script loads the others will work just fine.
When I try to directly access this JS file, I see this message:
HTTP/1.1 404 Not Found Filtered by error handler (static file exception)
I have verified that the file exists in the filesystem, so I know for sure that it's there, leading me to believe that the filesystem has that directory and/or file locked down. Permissions etc, are all set to their appropriate values.
Pimcore Version 4
It's been a few years and this project surfaced in our pipeline again. The actual cause for why this breaks was because we are also running the ModSecurity suite on our host. Accessing the interface .js file was triggering rule 2000009 where the pattern /var/tmp was being matched.
Possible solution (if you're using WHM/CPanel as we are):
Configure your /etc/apache2/conf.d/modsec2/whitelist.conf file to include the following rule (add more in the same place if needed).
<LocationMatch '/website'>
SecRuleRemoveById 2000009
</LocationMatch>
Be sure that you restart your HTTP service after making this update.
Enjoy!

jQuery.get() returns errors [duplicate]

This question already has an answer here:
Console shows error about Content Security policy and lots of failed GET requests
(1 answer)
Closed 8 years ago.
I use $.get function to get some html from exetrnal website in my chrome extension:
$.get(url, function(data) {
var someImgs= $(data).find('img[width="90"]').parent();
});
But I see such errors in my console:
chrome-extension://nqzxdldmasxchnkgibeedilpknlbndiho/files/image.png
I don't use any images in my extension, and I know this is link to image on exetrnal website.
What I tried:
wrap $.get() function into try-catch
handle error using $.ajaxError()
replace relevant links /files/image.png to full path: http://website/files/image.png using data.replace()
run example code in jsFiddle: errors are the same but despite of that code continiues running.
No ideas now. What I do wrong?
UPD: Error doesn't occur when I don't touch to data. When inside $.get I simple type console.log(data) there are no errors
UPD2: I also tried to download all the images whcih are mentioned in error messages and put them in the same path in my extension as on external website
UPD3: As it was mentioned in comments, images from remote website are reffering to relative paths. So I tried to replace relative paths in 'src' attribute to full, using this code:
var data = data.replace('/sites/default/', 'http://website/sites/default/');
As you guess - result is the same, same errors.
UPD4: Seems like replacement wasn't successful. I checked the above replacement and it says nothing changed:
console.log(data.indexOf('src="/sites/default/')); //returns integer
So, actually it was solved by downloading remote images to my extension foled. Little 'nasty' way but the only workable. Thanks to all the commentators that helped me to find out the source of problem.
Edit: On second look it appears that the html of the page at url contains images with relative file paths (like /files/menu_banners/ktc_apple.png), but when you interpret it and treat it with jQuery as a DOM object, it fails to load them because their urls are now interpreted as relative to the extension (cross-origin restrictions still apply, but that's not the issue since you've edited the manifest)
--
You are trying to make a cross-origin request, but jQuery isn't aware of a correct API to use when included in an extension and that is why it's failing. You can read more about XHR in Google Chrome extensions; you basically need to allow cross-domain access to your website URL:
By adding hosts or host match patterns (or both) to the permissions
section of the manifest file, the extension can request access to
remote servers outside of its origin:
//manifest.json
{
"name": "My extension",
...
"permissions": [
"http://www.google.com/"
],
...
}
So in your manifest you should include your http://website url, or use a wildcard http://*/ and allow access to any domain (handy in dev, terrible idea security-wise in production)

Categories