Goldfish, like all animals, are not affected by the light from a camera flash. The flash is simply a burst of light that is used to illuminate the subject, and it's not powerful enough to harm the fish in any way.
However, if you were to use a very powerful light source, such as a strobe light, it could potentially harm the fish.
It's also important to be mindful of the goldfish's well-being when taking pictures. Avoid stressing them out by making sudden movements or loud noises.