I would like to write it as a reference for those who are making a personally developed application and have a memorandum and a similar error.
I'm making a personally developed app with Rails. A function that acquires latitude and longitude (latitude, longitude) from an address when posting store information and displays it on a map.
As shown in the picture below, the map (Google Maps) is not displayed at the position where it should be displayed, and it is blank. It was able to be displayed normally until a few days ago.
And the map is displayed for the store information posted a few days ago. In other words, if you post a new post, the latitude and longitude cannot be obtained correctly from the address information, and the map cannot be displayed.
When I checked Google Cloud Platform, I was able to confirm that the Geocoding API was 100% error.
The cause is unknown even if it is investigated using a verification tool by Chrome. From the above Geocoding error, it can be inferred that the latitude and longitude cannot be obtained correctly from the address information (address).
When I investigate the error, I get API key setting mistakes and JavaScript description mistakes, but I could see it normally until a few days ago, and as mentioned above, all the past posts have maps. It is displayed correctly. In other words, it should not be a JavaScript typo.
Everything should have been set correctly to display the map, and it was displayed normally until a few days ago, so I thought there was something else, but no matter what I did for a few hours, it didn't fix. I haven't fixed anything on GitHub compared to the past of potentially relevant files.
I searched overseas sites such as StackOverFlow, but I couldn't find a decisive hit. When I was at a loss, ** I am using Docker for environment construction, so I decided to drop Docker once and build it again. ** **
local
$ docker-compose down
$ docker-compose build
$ docker-compose up -d
$ docker-compose run web rails db:create
$ docker-compose run web rails db:migrate
When I accessed the local host again in the test environment, I confirmed that the map was displayed safely. Even if I changed the address, I confirmed that the map was displayed by acquiring the latitude and longitude from the changed address information. Since we confirmed normal operation, we reflected it in the production environment (git push because CircleCI has already been installed). Confirm normal operation even in production and solve it!
I learned that restarting Docker can sometimes be a useful hit. Even when deploying AWS, the error was resolved at once by restarting EC2, so I was able to reconfirm that it is better to restart the environment once when doing everything. If you are using Docker with Rails and have introduced Google Maps API, and if it is displayed blank in the same way, please restart Docker once.
Recommended Posts