Repository navigation
Migrate the scripts in S3 to use script._id instead of the path value #486
Copy link
Copy link
Open
Labels
CODESome other Code related issue and it should clearly describe what it is affecting in a comment.Some other Code related issue and it should clearly describe what it is affecting in a comment.DBPertains inclusively to the Database operations.Pertains inclusively to the Database operations.bugYou've guessed it... this means a bug is reported.You've guessed it... this means a bug is reported.migrationUse this to indicate that it may apply to an existing or announced migration.Use this to indicate that it may apply to an existing or announced migration.needs discussionBlah, blah, blah, wahh, wahh, wahh, etc.Blah, blah, blah, wahh, wahh, wahh, etc.
Milestone
Description
Currently we are unable to upgrade the aws-sdk dependency because "something" changed that makes getObject to fail.
This has been explained in detail at aws/aws-sdk-js#430 . With all the test deploys done trying to figure out what the steps to reproduce are it appears that normalizing the casing when we save to the DB is an option.
Looking for more options related to advancing the goal of updating the dep... e.g. perhaps we could validate the current aReq.params.username against the real username (name) that is typically in the Raw JSON Data for an account. e.g. a lookup to correct the casing around here... but I suspect this is going to need to be a DB migration with a BLOCKING label until it is finished.
See also:
- Rethrown error when streaming aws/aws-sdk-js#397 (comment) error trap suggestion for loosely related
- https://github.com/OpenUserJs/OpenUserJS.org/blob/71ef808762ccf14a048c8a639d6d620e4e4e91e4/controllers/script.js#L350 Probably related and should be fixed
Test points:
- https://openuserjs.org/scripts/Marti/oujs_-_Meta_View/source vs https://openuserjs.org/scripts/marti/oujs_-_Meta_View/source e.g. manual url entry in the addy bar
- https://openuserjs.org/scripts/JRI/Geocaching_Map_Enhancements/source Since
jriis currently in the DB notJRI - https://openuserjs.org/users/jri (http://localhost:8080/users/jri with local pro)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
CODESome other Code related issue and it should clearly describe what it is affecting in a comment.Some other Code related issue and it should clearly describe what it is affecting in a comment.DBPertains inclusively to the Database operations.Pertains inclusively to the Database operations.bugYou've guessed it... this means a bug is reported.You've guessed it... this means a bug is reported.migrationUse this to indicate that it may apply to an existing or announced migration.Use this to indicate that it may apply to an existing or announced migration.needs discussionBlah, blah, blah, wahh, wahh, wahh, etc.Blah, blah, blah, wahh, wahh, wahh, etc.
Activity
Graceful failure when S3 *(fake or real)* doesn't have key
Martii commentedon Dec 6, 2014
With #487 we have another option of inline live migration... that patch currently fixes the net timeout in dev when selecting some other script source with fakeS3 and it usually just spins the browser spinner for an incredibly long time since our local dev DB doesn't usually have that source.
We can either correct the casing to what the user entered, if applicable, (e.g. a quick user search in the DB and if it is a hit compare it to the username portion generated from
installNameand migrate) from what we store in the Raw JSON Data or we can just lowercase migrate everything username wise... It is probably not recommended that we should alter the scriptname value though in casing with theKey.Updated the above for some test points and other linkage.
Zren commentedon Dec 6, 2014
Normally you wouldn't base the filename/keys based on the username/scriptname. Create an id for each source code and store it in the Script model. If we wanted to future proof ourselves, we wouldn't use the
Script._ideither as that means only 1 source code per Script. But since we're not versioning it atm, we could just use that.We have to fetch the Script model first before we doing any AWS stuff anyways.
Edit: Also noticed this when I tried to refactor the scriptEditSourceCodePage that never got finished. Most of the callbacks need to follow the
callback(err, ...)pattern so we can chain error up to the route handlers.sizzlemctwizzle commentedon Dec 6, 2014
I agree with @Zren. We should use
Script._idinstead since we have to do a lookup anyway.Martii commentedon Dec 7, 2014
Yah I'm not entirely sure how lower casing a Unicode character would affect things so a unique id would probably be best. EDIT: Searching will need to be retested for this as well.
Martii commentedon Dec 9, 2014
Just a FYI here's a short snippet from recent production log with the
isProconsole message I added in to check for this on pro e.g. the version of aws-sdk we are currently using hides/mishandles the error and possibly returns an empty payload as one of the maintainers stated... jri's script does show source and does install.Hmmm their clock appears to be a bit skewed too.
Martii commentedon Apr 27, 2015
Hmmm... retested this randomly with aws-sdk@2.1.25 and doesn't appear to crash dev nor local pro anymore... not sure on actual production. All prior test points appear to be okay (without crashing local pro). :\
@sizzlemctwizzle
Any objections to trying it on production? I'll give this a day or so for any responses.
Try for *aws-sdk-js* update
sizzlemctwizzle commentedon Apr 27, 2015
I have no problem with a temporary fix, but we definitely need to migrate the scripts in S3 to use
script._idinstead of the path value somewhere down the line. It's a simple migration but I'm always afraid I'm going to break something when I mess with S3. I spent hours trying to get everything right when I removed namespaces.5 remaining items
Hot fix for OpenUserJS#656
Missed STYLEGUIDE.md conformance
Some misc STYLEGUIDE.md conformance in `.../scriptStorage.js`
Change some defaults with MongoDB and stderr
Martii commentedon Apr 19, 2017
There's a major consequence to doing this... if
script._idis ever used as the key in S3, then if the DB ever needs to be "moved" somewhere all of the_ids could be different depending on how it was restored. If it's a DB backup and then a restore then it might be okay if it preserves the same_ids; but if it's a copy/delete op all of the_ids will be different and all source will be orphaned.NOTE: This is happening less and less as time progresses and fixes roll through.
Ensure casing on username is identical for S3 retrieval from DB
Ensure casing on username is identical for S3 retrieval from DB (#1086)
Clean up the console message for possible S3 errors
Clean up the console message for possible S3 errors (#1094)
Invert remote saves
Invert remote saves (#1098)