Issues with unconfigured Slack. New post fails with `Can not find property 'url' of undefined.`


#1

I solved this one myself, but I don’t understand why it happened, and it might help the team so I am sharing.

Config:

  • I am self hosting using a vultr VM
  • Ubuntu 16.04
  • nginx 1.10.3
  • Ghost 1.24.1 (production mode)
  • MySQL Ver 14.14 Distrib 5.7.22
  • using the latest Casper theme

Background if it matters:

  • I recently upgraded to 1.24.1 from 0.11.
  • Fresh install on a new VM.
  • Configured nginx myself with my own ssl crt and key
  • Exported data from old blog, imported in new.

Steps that lead to the error

  • Install is done. Website is confirmed up. Ghost is working.
  • Ghost Admin: Settings:Apps:Slack is not configured. I am not using it so I left this unconfigured.
  • Created a new post using GhostAdmin on a laptop (web browser, normal web app). Edited team member pages. Edited bad markdown on imported posts.
  • Everything is fine. All working as expected.
  • Using ghost app on android phone: create a new post with an image.
  • Post fails to publish but informs me that it saved locally
  • Check admin panel via web browser on laptop and confirm that new post is there and unpublished
  • I try to publish it there and it fails with that red banner: Can not find property 'url' of undefined.
  • using ghost-cli I check the logs and see 500 errors on the PUT request for the post.
  • core/server/services/slack.js is identified in the stack trying to send a ping request.

How I solved It

  • I insert a return at the top of the function ping(post) in core/server/services/slack.js
  • I restart ghost.
  • Create post. Publish.
  • Success

My Guess
getSlackSettings is returning an undefined object because I did not configure slack.


#2

Hey @aaronmfparr !

Thanks for your report. I can confirm this bug.
It’s already fixed in master and will be released today or tomorrow in 1.24.2.

See:

Sorry for trouble!


#3

Thank you.

I wonder why this suddenly started happening.


#4

Can you remember if you made any other changes with the mobile app or the desktop client?
Other than that, if you don’t mind: could you double check the value of the slack setting in your JSON import file? I noticed that if the slack value get’s set to an empty array, this error occurs. But i was unable to reproduce it.

Thanks for any help!


#5

Before this bug showed up, I didn’t make any changes to the mobile app nor ghost’s code on the server.

I transitioned over to ghost v1 from 0.11 on Friday. Made a test post with success. Then on Saturday tried to post via the mobile app.


#6

Sorry for ignoring this. I didn’t save the import file. So I can’t dig into the JSON.

I’m browsing in mysql (command line which I am not good at) …
app_settings is empty
apps is empty
settings has a line for slack with key ‘slack’ value ‘[]’