-
Notifications
You must be signed in to change notification settings - Fork 51
Open
Description
Problem
The "Export Gist" button on https://run.dlang.io/ fails with a 500 Internal Server Error when clicked.
Steps to Reproduce
- Go to https://run.dlang.io/
- Write any D code in the editor
- Click the "Export Gist" button
Console Error
POST https://run.dlang.io/api/v1/gist 500 (Internal Server Error)
angular.js:12722 TypeError: Cannot read properties of undefined (reading 'htmlUrl')
at tour-controller.js:383:21
at angular.js:14991:28
at r.$eval (angular.js:16251:16)
at r.$digest (angular.js:16069:15)
at r.$apply (angular.js:16359:13)
at g (angular.js:10791:36)
at R (angular.js:10989:7)
at v.onload (angular.js:10930:9)
Root Cause
After reviewing the code, the issue appears to be caused by a missing or invalid GITHUB_TOKEN environment variable on the production server.
Code Flow:
- Backend (
source/rest/apiv1.d:146-160) attempts to create a GitHub Gist - The authorization header uses
githubTokenwhich comes from environment variable - If empty/invalid, GitHub API returns 401 Unauthorized
- Backend catches this and returns 500 error: "GitHub API not available"
- Frontend (
public/static/js/tour-controller.js:381-384) receives undefined data and crashes trying to accessdata.htmlUrl
Proposed Fix
Set the GITHUB_TOKEN environment variable on the production server as documented in README.md (lines 144-148):
GITHUB_TOKENdefault: (empty)
Required for exporting Gists to GitHub.
Follow these instructions to generate a CLI GitHub token.
Additional Improvements (Optional)
- Improve frontend error handling to gracefully handle API failures instead of crashing
- Add startup validation to warn when GITHUB_TOKEN is not configured
- Show user-friendly error messages when the feature is unavailable
Status of "Shorten" Button
Unknown - needs testing to confirm if it's also affected by similar issues with the is.gd service.
Metadata
Metadata
Assignees
Labels
No labels