Search code examples
herokuparse-cloud-code

Error 403 running script in Heroku


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


Solution

  • This was a silly mistake. The variable for Javascript key should be JAVASCRIPT_KEY and not JS_KEY.

    Question is worth deleting but keeping if anyone encounter this issue.