Error 403 running script in Heroku

时间:2018-02-03 08:36:30

标签: heroku parse-cloud

I have this script in ./bin folder in Heroku. the script calls parse cloud function.

#!/usr/bin/env node

var Parse = require('parse/node');
Parse.initialize(process.env.APP_ID, process.env.JS_KEY, process.env.MASTER_KEY);
Parse.serverURL = process.env.SERVER_URL;

Parse.Cloud.run("resetJob");

The script runs without error

ashish$ heroku run:detached node bin/resetJob
Running node bin/resetJob on ⬢ myApp... done, run.4678 (Free)

Heroku console log shows below output. The cloud function has some console.log statements but their output also not appearing.

heroku[router]: at=info method=POST path="/parse/functions/resetJob" host=app.herokuapp.com request_id=21c57b19-26f5-4a11-8377-b3bbdc0c3ee6 fwd="54.224.125.131" dyno=web.1 connect=1ms service=5ms status=403 bytes=466 protocol=https

is status=403 an issue?

i checked the script in heroku bash console and shows as below:

-rwx — — — 1 u18777 dyno 219 Feb 2 17:35 resetJob

is file access rights an issue?

I have tested calling this function from Swift to test and it is working so cloud function is not the issue.

My final aim is to configure Heroku Scheduler to run this script.

Thanks

1 个答案:

答案 0 :(得分:0)

这是一个愚蠢的错误。 Javascript键的变量应该是JAVASCRIPT_KEY而不是JS_KEY。

问题值得删除,但如果有人遇到此问题,请保留。