'Invalid numeric literal when running jq from script via crontab

I have a shell script that runs fine from the command line but throws a error when it's run from a cronjob. What could be causing this error?

The following includes the cron, the script, and the error I'm getting in /var/spool/mail.

[jira-svc ~]$ cat jira_trigger_updater.sh
#!/usr/bin/sh

tmp_file=/tmp/merge-issues/$(date --iso-8601=minutes).txt
mkdir -p /tmp/merge-issues

/usr/bin/curl -s -X GET -H "Content-Type: application/json" "https://services-gateway.g054.usdcag.aws.ray.com/project-management/rest/api/2/search?jql=filter%3D14219&fields=key,status,fixVersions" -u jira-svc:${UPDATE_TRIGGER_PASSWORD} > ${tmp_file}
/usr/bin/jq -r '.issues[] | [.key , .fields.status.name , .fields.fixVersions[].name] | join(",")' ${tmp_file} > /rational/triggers/inputs/jira_merge.csv

/usr/bin/chmod 644 /rational/triggers/inputs/jira_merge.csv

#rm -rf /tmp/merge-issues
[jira-svc ~]$ crontab -l
#*/1 * * * * /usr/bin/sh /home/jira-svc/jira_trigger_updater.sh
[jira-svc@ ~]$ tail -25 /var/spool/mail/jira-svc
From [email protected]  Tue Feb  8 20:10:02 2022
Return-Path: <[email protected]>
X-Original-To: jira-svc
Delivered-To: [email protected]
Received: by cc01-217-136.localdomain (Postfix, from userid 1001)
        id 9C40168152B5; Tue,  8 Feb 2022 20:10:02 +0000 (UTC)
From: "(Cron Daemon)" <[email protected]>
To: [email protected]
Subject: Cron <jira-svc@cc01-217-136> /usr/bin/sh /home/jira-svc/jira_trigger_updater.sh
Content-Type: text/plain; charset=UTF-8
Auto-Submitted: auto-generated
Precedence: bulk
X-Cron-Env: <XDG_SESSION_ID=2172>
X-Cron-Env: <XDG_RUNTIME_DIR=/run/user/1001>
X-Cron-Env: <LANG=en_US.UTF-8>
X-Cron-Env: <SHELL=/bin/sh>
X-Cron-Env: <HOME=/home/jira-svc>
X-Cron-Env: <PATH=/usr/bin:/bin>
X-Cron-Env: <LOGNAME=jira-svc>
X-Cron-Env: <USER=jira-svc>
Message-Id: <[email protected]>
Date: Tue,  8 Feb 2022 20:10:02 +0000 (UTC)

parse error: Invalid numeric literal at line 13, column 0

[jira-svc ~]$


Solution 1:[1]

Cron runs jobs from a non-ineractive, non-login shell and doesn't load environment variables from files like ~/.bashrc, ~/.bash_profile, /etc/profile, and others. You must source these files if you want to include the environment variables defined in them.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 rezshar