You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Well, darn. that easy fix doesn't seem to have done the trick.
I just pushed this commit to Staging, OpenHistoricalMap/ohm-website@b148a04, which includes pointing at correct iD and also other changes we have made.
Same error: Uncaught TypeError: iD.utilDetect is not a function
I think this is going to end up not being an issue with our iD code but instead that the new OSM website code is somehow loading iD differently, but I'm not sure yet.
But looking more closely at that VENDORFILE, it seems like it's all getting subsidiary bits of code, and not the iD.js itself. I wonder if there's another place where that is specified. I'll keep poking at this.
It looks like the problem could be the iD version that is being pulled. I see that there are differences in the file names for iD and their sizes compared to the their counterparts on the main OHM site.
In our local dev environment, iD has been accessible int he past (before upstream catchup that we're working on in this ticket). Now we get a 500 error that's entirely different from what we see on Staging, as if the /id route doesn't existing locally:
Setting aside local dev issue for now, I suspect there's some sort of cache issue happening on staging where maybe we're not getting new code based on changes in the vendorfile.
Reading compiled/minified code is not my strong suit so I'm not trying to debug these, but really they should be the same since they are supposedly coming from the same source
The iframe on staging has src=https://staging.openhistoricalmap.org/id while on production it is https://openhistoricalmap.org/id. Removing staging. seems to resolve the issue (despite iD not being loaded because of some browser settings).
It is expected that the production OHM uses Production iD (https://openhistoricalmap.org/id) and the staging OHM uses Staging iD (https://staging.openhistoricalmap.org/id). Both should work and the fact that Staging iD doesn't work means we cannot roll the staging code out to production until we get it to work.
It also previous has worked in local dev, so I'm starting there now -- getting to work locally, then hopefully that will lead to fixing it on staging, which will mean we can eventually deploy staging code with new OSM website code to the production site.
So, back to local dev debugging. Looking at the local logs with the 500 error, we have:
I, [2022-06-17T20:54:20.887679 #35] INFO -- : [014c6fef-f0ee-407d-9355-f7fd3bfde7aa] Started GET "/id" for 172.22.0.1 at 2022-06-17 20:54:20 +0000
I, [2022-06-17T20:54:20.890167 #35] INFO -- : [014c6fef-f0ee-407d-9355-f7fd3bfde7aa] Processing by SiteController#id as HTML
I, [2022-06-17T20:54:21.259267 #35] INFO -- : [014c6fef-f0ee-407d-9355-f7fd3bfde7aa] Rendered site/id.html.erb (Duration: 89.0ms | Allocations: 868)
I, [2022-06-17T20:54:21.262952 #35] INFO -- : [014c6fef-f0ee-407d-9355-f7fd3bfde7aa] Completed 500 Internal Server Error in 371ms (ActiveRecord: 265.1ms | Allocations: 2862)
F, [2022-06-17T20:54:21.268172 #35] FATAL -- : [014c6fef-f0ee-407d-9355-f7fd3bfde7aa]
[014c6fef-f0ee-407d-9355-f7fd3bfde7aa] ActionView::Template::Error (undefined method `access_token_for_user' for nil:NilClass):[014c6fef-f0ee-407d-9355-f7fd3bfde7aa] 10: <body>[014c6fef-f0ee-407d-9355-f7fd3bfde7aa] 11: <% data = {}[014c6fef-f0ee-407d-9355-f7fd3bfde7aa] 12: if Settings.key?(:id_key)[014c6fef-f0ee-407d-9355-f7fd3bfde7aa] 13: token = current_user.access_token(Settings.id_key)[014c6fef-f0ee-407d-9355-f7fd3bfde7aa] 14: data[:token] = token.token[014c6fef-f0ee-407d-9355-f7fd3bfde7aa] 15: data[:token_secret] = token.secret[014c6fef-f0ee-407d-9355-f7fd3bfde7aa] 16: data[:consumer_key] = token.client_application.key[014c6fef-f0ee-407d-9355-f7fd3bfde7aa][014c6fef-f0ee-407d-9355-f7fd3bfde7aa] app/models/user.rb:346:in `access_token'[014c6fef-f0ee-407d-9355-f7fd3bfde7aa] app/views/site/id.html.erb:13[014c6fef-f0ee-407d-9355-f7fd3bfde7aa] app/controllers/site_controller.rb:125:in `id'[014c6fef-f0ee-407d-9355-f7fd3bfde7aa] config/initializers/compressed_requests.rb:27:in `call'
[014c6fef-f0ee-407d-9355-f7fd3bfde7aa] config/initializers/cors.rb:9:in `call'I, [2022-06-17T20:54:21.272729 #35] INFO -- : [014c6fef-f0ee-407d-9355-f7fd3bfde7aa] Processing by ErrorsController#internal_server_error as HTMLI, [2022-06-17T20:54:21.275626 #35] INFO -- : [014c6fef-f0ee-407d-9355-f7fd3bfde7aa] Rendered errors/internal_server_error.html.erb within layouts/error (Duration: 0.1ms | Allocations: 4)I, [2022-06-17T20:54:21.281669 #35] INFO -- : [014c6fef-f0ee-407d-9355-f7fd3bfde7aa] Rendered layout layouts/error.html.erb (Duration: 6.1ms | Allocations: 2241)I, [2022-06-17T20:54:21.283427 #35] INFO -- : [014c6fef-f0ee-407d-9355-f7fd3bfde7aa] Completed 500 Internal Server Error in 9ms (Views: 8.0ms | ActiveRecord: 0.0ms | Allocations: 2444)I, [2022-06-17T20:54:21.312526 #35] INFO -- : [8190193c-bc2c-47af-b745-793c3dc5ad6f] Started GET "/assets/errors-f22ac01f5c336b3c39aad5b6efe71abb4c85eaa779786e388c0f963caaa8f43e.css" for 172.22.0.1 at 2022-06-17 20:54:21 +0000I, [2022-06-17T20:54:21.345301 #35] INFO -- : [841b43aa-fba3-4ab3-b046-a01924ed61d9] Started GET "/assets/osm_logo-4afddaae0230a5a46687fdc751ed256dfdccde144118cb02a7d7960f207a4b92.svg" for 172.22.0.1 at 2022-06-17 20:54:21 +0000
I still think we are simply not loading iD.js properly somehow.
Based on this SO post, I tried rake assets:clobber to see if I just needed a complete rebuild of some sort.
Naturally, this rendered my local env inoperable... Gah. I should have started with rake assets:clean
Now, despite redoing all of Steps 5 and 6 here, I've got a nonfunctional local environment. Sigh
rake aborted!
Errno::ENOENT: No such file or directory @ rb_sysopen - /var/www/tmp/cache/assets/sprockets/v4.0.0/-J/-JIIFe-XlDjmZNt7l0ukVnyHL2bKXsmebFM9m8_y91I.cache.27360.672.828947
For whatever reason, stopping my container and restarting it, then rerunning Steps 5 and 6 worked -- and as expected the assets precompile took way longer.
I'll need to enlist others on my team to solve this. Since both production and staging vendorfiles should be pulling iD.js from the same source, I would expect the minified code to be the same, but it's just not.
We can see that the definitions for function utilDetect look different:
I'm beyond the edges of my abilities in understanding when and how build artifacts can differ in ways that don't matter, but the fact that broken local and broken staging are the same, while working production is different certainly suggests this different is the immediate cause.
What I have not yet divined is what is the underlying cause of the difference!
Since iD version 2.20, the presets are hosted in a separate repository. The production server is using iD 2.18.5 and I assume that the staging server is using a newer version. I'm not sure if it can cause such a problem though. It might be a good idea to consult with one of the iD developers.
I spent some time on this with @gregallensworth and we've concluded that our best approach here is to get a plain version of the newest iD working with newest web code, then fold back in our changes to iD.
Hand-made the changes to image asset URLs that the Vendorfile should be doing automatically here
So now we know that newest iD release works just fine with newest OSM website. No surprise there! Just a bit painful trying to make that be true in our code.
Challenges remain:
How can we get the Vendorfile to actually execute so that, for example, we could temporarily pull in OSM iD and deploy that to staging without the hacky steps above and then, soon, redeploy a version with our mods
We need to figure out the git-fu to get a clean checkout of latest iD code, to which we could then apply our changes, which include presets and the date filter, including URL params for date filter.
@Rub21 can you take a look at that and see why we removed the vendorer updates from the Staging Dockerfile? Can we just restore those few lines and redeploy?
Edited to add -- just just added them back OpenHistoricalMap/ohm-deploy@59121b6 and if that Action completes successfully, I am going to merge into staging and verify that iD is working again there.
I think that might fix iD and unblock the upstream merge -- we might still want to catch up to latest iD, but we could then do that without it blocking the website catchup.
OK, adding those back in worked and the job completed successfully:
I then merged that into staging so we'd have the latest there and see if iD works now.
and voila:
So while we do need to update iD, the cause of this specific breakage is unrelated to iD version. It's that we had a broken version of the vendor files, and then we disabled the system that would overwrite them on each deploy.
I will file a new, lower priority ticket for catching up with iD upstream, but that no longer needs to be a blocker on catching up with website upstream
Activity
danrademacher commentedon Jun 13, 2022
I suspect this is a simple fix. In the Vendorfile in
stagingbranch we have:https://github.com/OpenHistoricalMap/ohm-website/blob/staging/Vendorfile#L54
from 'https://github.com/openhistoricalmap/iD', :branch => 'release' doIn the Vendorfile on
merge-osm-websitewe have:https://github.com/OpenHistoricalMap/ohm-website/blob/merge-osm-website/Vendorfile#L28
from 'https://github.com/openstreetmap/iD', :branch => 'release' doI would expect that changing
openstreetmaptoopenhistoricalmapin the branch Vendorfile and rerunning build should fix this.OpenHistoricalMap/issues#388 (comment) iD fix OHM URL
danrademacher commentedon Jun 14, 2022
Well, darn. that easy fix doesn't seem to have done the trick.
I just pushed this commit to Staging, OpenHistoricalMap/ohm-website@b148a04, which includes pointing at correct iD and also other changes we have made.
Same error:
Uncaught TypeError: iD.utilDetect is not a functionI think this is going to end up not being an issue with our iD code but instead that the new OSM website code is somehow loading iD differently, but I'm not sure yet.
The iframe target for iD is https://staging.openhistoricalmap.org/id, and we see the same error there. On prod, https://openhistoricalmap.org/id works fine.
In theory both are getting iD from the same place, base don this vendorfile:
https://github.com/OpenHistoricalMap/ohm-website/blob/production/Vendorfile#L53-L59
But looking more closely at that VENDORFILE, it seems like it's all getting subsidiary bits of code, and not the iD.js itself. I wonder if there's another place where that is specified. I'll keep poking at this.
Dimitar5555 commentedon Jun 14, 2022
It looks like the problem could be the iD version that is being pulled. I see that there are differences in the file names for iD and their sizes compared to the their counterparts on the main OHM site.
Dimitar5555 commentedon Jun 14, 2022
Also, the staging version is pointing to
dist/iD.legacy.jsinstead ofdist/iD.js. I'm not sure if that's on purpose.https://github.com/OpenHistoricalMap/ohm-website/blob/b148a04c3b5f5167db7386abff8c7934fad6ee58/Vendorfile#L41
danrademacher commentedon Jun 14, 2022
Aha I was just typing that same thing!
Now I see that the VENDORFILE is the place where we put the main JS in place as well:
https://github.com/OpenHistoricalMap/ohm-website/blob/production/Vendorfile#L67
But interestingly, the VENDORFILE on our upstream branch references a different source file:
https://github.com/OpenHistoricalMap/ohm-website/blob/merge-osm-website-gin20220525/Vendorfile#L41
Repoint at iD at main iD.js file
danrademacher commentedon Jun 14, 2022
Well, that didn't fix it either. Same error, and also I notice the size difference you saw, with production iD at 600K and staging at 1MB+

Also noting that staging is failing to load the additional other files (Mapillary and Pannelium)
danrademacher commentedon Jun 14, 2022
In our local dev environment, iD has been accessible int he past (before upstream catchup that we're working on in this ticket). Now we get a 500 error that's entirely different from what we see on Staging, as if the

/idroute doesn't existing locally:danrademacher commentedon Jun 14, 2022
Setting aside local dev issue for now, I suspect there's some sort of cache issue happening on staging where maybe we're not getting new code based on changes in the vendorfile.
These two code blocks are now identical:
But the ID files they are loading are not identical. Comparing
Reading compiled/minified code is not my strong suit so I'm not trying to debug these, but really they should be the same since they are supposedly coming from the same source
Dimitar5555 commentedon Jun 15, 2022
The
iframeon staging hassrc=https://staging.openhistoricalmap.org/idwhile on production it ishttps://openhistoricalmap.org/id. Removingstaging.seems to resolve the issue (despite iD not being loaded because of some browser settings).danrademacher commentedon Jun 17, 2022
It is expected that the production OHM uses Production iD (
https://openhistoricalmap.org/id) and the staging OHM uses Staging iD (https://staging.openhistoricalmap.org/id). Both should work and the fact that Staging iD doesn't work means we cannot roll the staging code out to production until we get it to work.It also previous has worked in local dev, so I'm starting there now -- getting to work locally, then hopefully that will lead to fixing it on staging, which will mean we can eventually deploy staging code with new OSM website code to the production site.
So, back to local dev debugging. Looking at the local logs with the 500 error, we have:
OK, for local dev this turned out to be a RTFM scenario. Following the instructions at https://github.com/OpenHistoricalMap/ohm-website/blob/merge-osm-website/CONFIGURE.md#oauth-consumer-keys get us to the same place as we are on staging:
iD.utilDetect is not a functionAt least now we can debug locally!
danrademacher commentedon Jun 17, 2022
I still think we are simply not loading iD.js properly somehow.
Based on this SO post, I tried
rake assets:clobberto see if I just needed a complete rebuild of some sort.Naturally, this rendered my local env inoperable... Gah. I should have started with
rake assets:cleanNow, despite redoing all of Steps 5 and 6 here, I've got a nonfunctional local environment. Sigh
For whatever reason, stopping my container and restarting it, then rerunning Steps 5 and 6 worked -- and as expected the assets precompile took way longer.
Now everything is precompiled from scratch and...
Same error!
danrademacher commentedon Jun 17, 2022
I'll need to enlist others on my team to solve this. Since both production and staging vendorfiles should be pulling iD.js from the same source, I would expect the minified code to be the same, but it's just not.
Local dev matches staging and also fails.
So these two files differ:
We can see that the definitions for

function utilDetectlook different:I'm beyond the edges of my abilities in understanding when and how build artifacts can differ in ways that don't matter, but the fact that broken local and broken staging are the same, while working production is different certainly suggests this different is the immediate cause.
What I have not yet divined is what is the underlying cause of the difference!
Dimitar5555 commentedon Jun 18, 2022
Since iD version 2.20, the presets are hosted in a separate repository. The production server is using iD 2.18.5 and I assume that the staging server is using a newer version. I'm not sure if it can cause such a problem though. It might be a good idea to consult with one of the iD developers.
danrademacher commentedon Jun 22, 2022
I spent some time on this with @gregallensworth and we've concluded that our best approach here is to get a plain version of the newest iD working with newest web code, then fold back in our changes to iD.
@batpad one thing we noticed is that you committed to this folder last month, https://github.com/OpenHistoricalMap/ohm-website/tree/merge-osm-website/vendor/assets/iD
Do you recall what the source of that replacement iD.js was?
It seems to me that these lines in the Vendorfile do not do what I thought they would, which is to replace the contents of the
vendor/iDfolder with whatever is specified there. They must do that at some point, but not with any of the build or setup commands we are currently running as documented at https://github.com/OpenHistoricalMap/ohm-deploy/tree/new_web_version/images#setting-up-ohm-website-for-development-modedanrademacher commentedon Jun 28, 2022
OK, I made some progress here!
Here's iD working on localhost:

This is the commit that "fixed" it: OpenHistoricalMap/ohm-website@5c115cd
What I did:
releaselocally and hand picked the files from this folder: https://github.com/openstreetmap/iD/tree/release/dist that should be automatically copied when the Vendorfile is runSo now we know that newest iD release works just fine with newest OSM website. No surprise there! Just a bit painful trying to make that be true in our code.
Challenges remain:
danrademacher commentedon Jun 28, 2022
Looking at updates we will need to redo:
start_dateandend_dateto presetsSo basically we have:
danrademacher commentedon Jun 28, 2022
Preset repo forked here:
https://github.com/OpenHistoricalMap/id-tagging-schema
danrademacher commentedon Jun 28, 2022
OK, simple answer on the Vendorfile:
https://github.com/OpenHistoricalMap/ohm-deploy/blob/main/images/web/Dockerfile#L133-L135
so in the container, we do:
and that looks like this:
And, wow, the OHM iD is working fine, with date filters! 🙄

If this is running automatically on
ohm-deploywhenever we deploy, then my original fix at the top of this ticket should have worked!danrademacher commentedon Jun 28, 2022
Aha, I think I got it:
vendorat all: https://github.com/OpenHistoricalMap/ohm-deploy/blob/staging/images/web/DockerfileThose were removed here:
OpenHistoricalMap/ohm-deploy@5eb6f44#diff-03a61f635e59ab9d93c26690c3d752b840586e60d16ad70fb6edd14bd6046a30L133-L135
@Rub21 can you take a look at that and see why we removed the vendorer updates from the Staging Dockerfile? Can we just restore those few lines and redeploy?
I think that might fix iD and unblock the upstream merge -- we might still want to catch up to latest iD, but we could then do that without it blocking the website catchup.
Restore vendorer to dockerfile
danrademacher commentedon Jun 29, 2022
OK, adding those back in worked and the job completed successfully:

I then merged that into
stagingso we'd have the latest there and see if iD works now.and voila:

So while we do need to update iD, the cause of this specific breakage is unrelated to iD version. It's that we had a broken version of the vendor files, and then we disabled the system that would overwrite them on each deploy.
I will file a new, lower priority ticket for catching up with iD upstream, but that no longer needs to be a blocker on catching up with website upstream
cc @batpad @Rub21