I have this program that I have managed to upload to heroku without error. But when I open it in the browser, then if I keep in there a line that uses Regexp, I get "internal server error". If I comment it out it's fine.
I have looked at similarly titled questions about Heroku giving "internal server error", but they don't involve Regexp, and they haven't given me any ideas as to what I need to do to make it work. For example Heroku deployment internal server error the person was using python and a package he had installed was incompatible, that doesn't seem relevant to my issue. This one Heroku + Django Internal server Error a guy had to import something called djcelery. Well, maybe I have to import something somewhere, but I don't know what, but it wouldn't be djcelery 'cos i'm not using django.
C:\rubytest\regexinheroku1>dir /b
aaa.rb
config.ru
Gemfile
Gemfile.lock
C:\rubytest\regexinheroku1>
here is aaa.rb
C:\rubytest\regexinheroku1>type aaa.rb
require 'sinatra'
get '/' do
z=Regexp.new('.').match?('qwerty')
"aaaa"
end
This succeeds
C:\rubytest\regexinheroku1>git push heroku master
.... deployed to Heroku
Here is the problem though
If I go to the URL, it says "Internal Server Error"
However, if I change aaa.rb by commenting out the regexp line
C:\rubytest\regexinheroku1>type aaa.rb
require 'sinatra'
get '/' do
# z=Regexp.new('.').match?('qwerty')
"aaaa"
end
Then it works fine, a page comes up and says "aaaa" as expected.
If you want to reproduce this and the above isn't enough, here are all the steps
So you see the files
C:\rubytest\regexinheroku2>dir /b
aaa.rb
config.ru
Gemfile
The contents of each file
C:\rubytest\regexinheroku2>type aaa.rb
require 'sinatra'
get '/' do
z=Regexp.new('.').match?('qwerty') # if I uncomment this, I get internal server error
"aaaa"
end
C:\rubytest\regexinheroku2>type config.ru
require './aaa'
run Sinatra::Application
C:\rubytest\regexinheroku2>
C:\rubytest\regexinheroku2>type Gemfile
source "http://rubygems.org/"
gem 'sinatra'
gem "haml"
And see the commands I run to get the application successfully deployed
C:\rubytest\regexinheroku2>bundle install
...
C:\rubytest\regexinheroku2>git init
Initialized empty Git repository in C:/rubytest/regexinheroku2/.git/
C:\rubytest\regexinheroku2>git add -A
warning: LF will be replaced by CRLF in Gemfile.lock.
The file will have its original line endings in your working directory.
C:\rubytest\regexinheroku2>git commit -m "sddsfsdfsd"
[master (root-commit) 12cf382] sddsfsdfsd
warning: LF will be replaced by CRLF in Gemfile.lock.
The file will have its original line endings in your working directory.
4 files changed, 39 insertions(+)
create mode 100644 Gemfile
create mode 100644 Gemfile.lock
create mode 100644 aaa.rb
create mode 100644 config.ru
C:\rubytest\regexinheroku2>heroku create
path1 gitmisc done
Creating app... done, abc
https://abc.herokuapp.com/ | ....
C:\rubytest\regexinheroku2>git push heroku master
....
remote: Verifying deploy... done.
To https://git.heroku.com/abc.git
* [new branch] master -> master
C:\rubytest\regexinheroku2>