Thimble crashes when publishing

RESOLVED FIXED

Status

RESOLVED FIXED
6 years ago
5 years ago

People

(Reporter: jon, Assigned: pomax)

Tracking

Details

(Whiteboard: s=2013w21 p=1)

Attachments

(1 attachment)

(Reporter)

Description

6 years ago
When visiting http://thimble-node.mofostaging.net/remix/14/edit , if you attempt to publish the project the server will crash with the following error:

TypeError: Cannot call method 'updateAttributes' of null
    at module.exports.databaseAPI.update.updateProject (/var/www/thimble/lib/database.js:66:17)
    at EventEmitter.emit (events.js:96:17)
    at module.exports.queryAndEmit (/var/www/thimble/node_modules/sequelize/lib/query-interface.js:291:17)
    at EventEmitter.emit (events.js:126:20)
    at module.exports.Query.run (/var/www/thimble/node_modules/sequelize/lib/dialects/mysql/query.js:32:14)
    at Query.Sequence.end (/var/www/thimble/node_modules/mysql/lib/protocol/sequences/Sequence.js:66:24)
    at Query._handleFinalResultPacket (/var/www/thimble/node_modules/mysql/lib/protocol/sequences/Query.js:139:8)
    at Query.EofPacket (/var/www/thimble/node_modules/mysql/lib/protocol/sequences/Query.js:123:8)
    at Protocol._parsePacket (/var/www/thimble/node_modules/mysql/lib/protocol/Protocol.js:169:24)
    at Parser.write (/var/www/thimble/node_modules/mysql/lib/protocol/Parser.js:62:12)
Summary: Popcorn Maker crashes when → Thimble crashes when publishing
(Reporter)

Comment 1

6 years ago
Alright, after looking at the database record for id=14, I saw that the creator of that project was scott, not jacob. Evidently the logic here for updating vs creating a new project isn't working correctly
(Assignee)

Updated

6 years ago
Assignee: jon → pomax
(Assignee)

Comment 2

6 years ago
I cannot reproduce this error in the same way, but there's definitely something weird going on. Trying publish locks up thimble-node.mofostaging.net for me instead (resulting in a 503).
(Assignee)

Comment 3

6 years ago
reproduced locally. It appears we're missing the step that verifies the originalURL is actually "owned" by the currently logged in user. An extra middleware step is required.
(Assignee)

Comment 4

6 years ago
Created attachment 754496 [details] [review]
https://github.com/mozilla/thimble.webmaker.org/pull/79

extended the originalURL middleware function so it only adds that property if the currently logged in user owns the original page. Otherwise this should actually be a new page when published.
Attachment #754496 - Flags: review?(scott)
(Assignee)

Updated

6 years ago
Whiteboard: s=2013w21 → s=2013w21 p=1
Comment on attachment 754496 [details] [review]
https://github.com/mozilla/thimble.webmaker.org/pull/79

Worked.

I left a nit in the pull request, but I'm not sure it matters. You can consider it, your call.
Attachment #754496 - Flags: review?(scott) → review+
(Assignee)

Comment 6

6 years ago
landed.
Status: ASSIGNED → RESOLVED
Last Resolved: 6 years ago
Resolution: --- → FIXED
Attachment mime type: text/plain → text/x-github-pull-request
You need to log in before you can comment on or make changes to this bug.