- putting your scheduled task in a file without an extension…
- in a directory called ‘bin’, and…
- executing it without specifying
nodein the command, but instead adding
#!/path/to/nodeto the top of the task file.
I originally didn’t look at any of these tutorials - I guessed from the examples using other languages in the Heroku docs that I could just write a normal
However, Heroku also asserts that you should be able to test your task by running
heroku run my task locally, but every time I tried this, it would fail with the following error:
Wait, hold on just one cott’n pickin’ secon’. I just went to run it so I could dutifully copy the exact error message for y’all, and it ran WITHOUT GLITCHES. wAT?!??
Well. My only proposed explanation is that all the times I ran this in the past, I either
1) hadn’t added, committed, and pushed the file to Heroku, or
2) hadn’t waited long enough after adding, committing, and pushing to Heroku for it to be available.
Idk if that last one makes any sense. But I swear it has to be something like that, because after reading a tutorial that (said I should be able to do it the way I was doing it, plus) specified adding and committing and pushing the file before trying to
heroku run it, I definitely made sure I had done that.
Anyway, where I was going with this was to say that it kept claiming it couldn’t find the
My Heroku scheduled tasks now looked like this:
I gratefully soon received an email from my task! It was from the file I had originally included - the one that made structural sense to me. Phew. Maybe I do understand things after all.
Now I wait to see if the other file will also send me an email! I hope the suspense doesn’t kill me. If it doesn’t, I’ll just delete it. If it does, I’ll delete it anyway.* Teehee - it’s all for science!
* I’ll delete it anyway because I don’t need two files for one task, and I wanna keep the one I came up with all on my own!