I have a web app I'm currently working on, I just came across of an issue right after the system finishes executing git push heroku master. In development, the app works fine. I've already changed the db to PostgreSQL, so there's no issue to push. But after the push, when I try to see the app online, it tells me there's an error, when I search the heroku logs via the command Heroku logs --tail, here's what I found for errors:
Completed 500 Internal Server Error in 866ms
at parse_error (/tmp/execjs20130330-2-1s2w7pb.js:1824:17)
at new JS_Parse_Error (/tmp/execjs20130330-2-1s2w7pb.js:1720:22)
ActionView::Template::Error (Unexpected character '#' (line: 11021, col: 1, pos: 312418)
Error
at js_error (/tmp/execjs20130330-2-1s2w7pb.js:1728:15)
at Object.semicolon [as 1] (/tmp/execjs20130330-2-1s2w7pb.js:2221:38)
at simple_statement (/tmp/execjs20130330-2-1s2w7pb.js:2362:35)
at /tmp/execjs20130330-2-1s2w7pb.js:2265:32
at Object.next_token [as input] (/tmp/execjs20130330-2-1s2w7pb.js:2070:17)
at next (/tmp/execjs20130330-2-1s2w7pb.js:2175:37)
at /tmp/execjs20130330-2-1s2w7pb.js:2753:32
(in /app/app/assets/javascripts/application.js)):
9: <body>
6: <%= javascript_include_tag
4: <title>Pinsvault</title>
I can't see where to go to fix, it seems something with JavaScript, but I don't have anything like that in development.
Looks like you're not closing your javascript_include_tag, try adding %>
<%= javascript_include_tag %>
You can try to verify this locally with the Chrome inspector's console tab. See if you have any javascript errors there.
Related
I have a Rails 7 app with Postgresql database and AWS S3 image storage. It's currently deployed on Heroku and I want to migrate to Railway (https://railway.app/).
I have successfully deployed the app and migrated the database to Railway, and everything is working fine EXCEPT images. The ones already uploaded to S3 aren't showing up, and when I try to add a new image, the app crashes and I get the following error:
ActionView::Template::Error (You must have ImageMagick or GraphicsMagick installed)
I have tried reinstalling ImageMagick but it doesn't do anything. Everything is still working fine on the Heroku deployment.
In addition, every time I deploy on Railway, it says I don't have Ruby 3.2.1 installed, so it reinstalls it each time and deployment takes about 6 minutes (instead of 30 seconds on Heroku). I get this warning:
Warning! PATH is not properly set up, /usr/local/rvm/gems/3.1.2/bin is not available.
Could they be related somehow?
Could there be something to do with AWS S3 that makes it so the images don't show up?
Is there something I need to do to install ImageMagick and Ruby 3.2.1 directly into Railway? Why does it not recognize them?
Update:
I added the following to my variables, and switched to the Heroku buildpack (in Railway) per this article and this discord thread.
NIXPACKS_PKGS=imagemagick
NIXPACKS_APT_PKGS=libimagemagick-dev
Now I no longer get the Ruby 3.2.1 path warning. I am able to add an image BUT it seems like it's only in local storage. When I refresh the app crashes again, with an empty error message in the logs:
I, [2022-11-02T06:31:25.034636 #120] INFO -- : [8a1f130e-6718-4a29-9f9f-d3a27f200e35] Completed 500 Internal Server Error in 7025ms (ActiveRecord: 94.6ms | Allocations: 106325)
F, [2022-11-02T06:31:25.036160 #120] FATAL -- : [8a1f130e-6718-4a29-9f9f-d3a27f200e35]
[8a1f130e-6718-4a29-9f9f-d3a27f200e35] ActionView::Template::Error (`convert /tmp/ActiveStorage-118-20221102-120-zx3huu.jpg[0] -auto-orient -resize 150x150> /tmp/image_processing20221102-120-yfhkye.jpg` failed with error:
):
[8a1f130e-6718-4a29-9f9f-d3a27f200e35] 54: <% if review.images.exists? %>
[8a1f130e-6718-4a29-9f9f-d3a27f200e35] 55: <% review.images.each do |image| %>
[8a1f130e-6718-4a29-9f9f-d3a27f200e35] 56: <% if review.images.attached? && image.content_type.in?(%w[image/gif image/jpeg image/png]) %>
[8a1f130e-6718-4a29-9f9f-d3a27f200e35] 57: <%= link_to image_tag(review.image_as_thumbnail(image)), image, class: "img-thumbnail border-0 px-0", target: :_blank %>
[8a1f130e-6718-4a29-9f9f-d3a27f200e35] 58: <% end %>
[8a1f130e-6718-4a29-9f9f-d3a27f200e35] 59: <% end %>
[8a1f130e-6718-4a29-9f9f-d3a27f200e35] 60: <% end %>
2nd Update
It seems like it's happening only for images I already uploaded. Is it possible that Heroku adds something to images uploaded to ensure they're unique, that I would have to do in the code instead when using Railway?
I have a Rails app which works locally. When I deploy it to heroku and try to see it, the page is just white and in the dev console i see the error:
"TypeError: o is not a function
at e (application-3cf416d1f738bfa0c9751b6f067d24ba462ae0d1fd10b7551c9f996491da5fbb.js:formatted:1134)
at i (application-3cf416d1f738bfa0c9751b6f067d24ba462ae0d1fd10b7551c9f996491da5fbb.js:formatted:1085)
at Object.merge (application-3cf416d1f738bfa0c9751b6f067d24ba462ae0d1fd10b7551c9f996491da5fbb.js:formatted:1137)
at o.request (application-3cf416d1f738bfa0c9751b6f067d24ba462ae0d1fd10b7551c9f996491da5fbb.js:formatted:3919)
at o.(/anonymous function) [as get] (https://syndicatorproto.herokuapp.com/assets/application-3cf416d1f738bfa0c9751b6f067d24ba462ae0d1fd10b7551c9f996491da5fbb.js:3:12554)
at Function.get (application-3cf416d1f738bfa0c9751b6f067d24ba462ae0d1fd10b7551c9f996491da5fbb.js:formatted:2218)
at n.value (application-3cf416d1f738bfa0c9751b6f067d24ba462ae0d1fd10b7551c9f996491da5fbb.js:formatted:8652)
at er (application-3cf416d1f738bfa0c9751b6f067d24ba462ae0d1fd10b7551c9f996491da5fbb.js:formatted:12162)
at Jn (application-3cf416d1f738bfa0c9751b6f067d24ba462ae0d1fd10b7551c9f996491da5fbb.js:formatted:11938)
at Qn (application-3cf416d1f738bfa0c9751b6f067d24ba462ae0d1fd10b7551c9f996491da5fbb.js:formatted:11899)"
I have no idea what this error is does anyone have an idea ? Heroku logs don't show an error.
I have a JRuby Rails app. It runs with "rails s app".
With warbler I have built a war-file and integrated it with the tomcat.
The app starts, but then I get an error message:
"We're sorry, but something went wrong."
In the log file, the following is displayed:
"INFO: F, [2016-12-14T11: 06: 40.187000 # 124] FATAL -:
ActionView :: Template :: Error (undefined: SyntaxError: Unexpected token: eof (undefined)):
7:
8: .row
9: .col-md-6
10: = image_tag 'leaman_ir_doc.png', style: "width: 100%, border: 2px solid gray;"
11:
App / views / home / index.html.haml: 10: in `_app_views_home_index_html_haml__819972750_6656 '"
I do not know where the SyntaxError comes from !?
The error means that the images and stylsheets are not found. If I leave in the development.rb or production.rb under config following entry away, then runs the application error-free:
Config.assets.js_compressor =: uglifier
Does anyone know why with this setting the images and stylsheets are no longer found and what I can do about it?
Thanks for any answer :-)
I have deployed my webapp on CentOS 7 using bundle --standalone and have configured the app to use the correct gems by using .bundle/config. It works great when I use rails server, but when I set it up to use passenger I get the following error:
[ 2016-02-02 13:27:50.7037 5134/7fb8225b8700 age/Cor/App/Implementation.cpp:304 ]: Could not spawn process for application /var/www/rails-web: An error occurred while starting up the preloader. It exited before signalling successful startup back to Phusion Passenger.
Error ID: 7b0eafb9
Error details saved to: /tmp/passenger-error-YR2EzW.html
Message from application: An error occurred while starting up the preloader. It exited before signalling successful startup back to Phusion Passenger. Please read this article for more information about this problem.<br>
<h2>Raw process output:</h2>
<pre>
/usr/share/rubygems/rubygems/path_support.rb:68:in `path=': undefined method `+' for nil:NilClass (NoMethodError)
from /usr/share/rubygems/rubygems/path_support.rb:30:in `initialize'
from /usr/share/rubygems/rubygems.rb:357:in `new'
from /usr/share/rubygems/rubygems.rb:357:in `paths'
from /usr/share/rubygems/rubygems.rb:379:in `path'
from /usr/share/rubygems/rubygems/specification.rb:794:in `dirs'
from /usr/share/rubygems/rubygems/specification.rb:658:in `each_normal'
from /usr/share/rubygems/rubygems/specification.rb:669:in `_all'
from /usr/share/rubygems/rubygems/specification.rb:822:in `each'
from /usr/share/rubygems/rubygems/specification.rb:864:in `find'
from /usr/share/rubygems/rubygems/specification.rb:864:in `find_inactive_by_path'
from /usr/share/rubygems/rubygems.rb:175:in `try_activate'
from /usr/share/rubygems/rubygems/core_ext/kernel_require.rb:132:in `rescue in require'
from /usr/share/rubygems/rubygems/core_ext/kernel_require.rb:144:in `require'
from <internal:abrt_prelude>:2:in `<compiled>'
</pre>
The code around path_support.rb:68 involves setting GEM_PATH. What does this error message mean and how can I fix it. Thanks.
This appears passenger looks in /home/<username>/.gem/ruby as a part of its spawn process. If /home/<username> doesn't exist (like with system users that don't have home directories), you get this error.
Here is the bug report.
I have been trying to follow several tutorials on rails and each time I am hitting the following issue at the time of running rails s:
Started GET "/" for 127.0.0.1 at 2014-09-14 06:57:44 +0100
Connecting to database specified by database.yml
Processing by CarsController#index as HTML
Car Load (1.0ms) SELECT "cars".* FROM "cars"
Rendered cars/index.html.erb within layouts/application (396.0ms)
Completed 500 Internal Server Error in 101655ms
ActionView::Template::Error (incomplete "\n" on UTF-16LE
(in /cygdrive/c/rails/todolist/3/rails-angular-example-master/app/assets/javascripts/angular_app.js.coffee.erb)):
3: <head>
4: <title>Angular</title>
5: <%= stylesheet_link_tag "application", :media => "all" %>
6: <%= javascript_include_tag "application" %>
7: <%= csrf_meta_tags %>
8: </head>
9: <body>
app/views/layouts/application.html.erb:6:in `_app_views_layouts_application_html_erb__988651031__1054838708'
app/controllers/cars_controller.rb:6:in `index'
config/initializers/quiet_assets.rb:8:in `call_with_quiet_assets'
Tutorial:https://github.com/wulftone/rails-angular-example
This occurs when ExecJS tries to process your assets (javascript and coffeescript) and your file encoding is not UTF-16LE.
Most popular fix: use an alternative ExecJS runtime
Probably the most popular fix is to use NodeJS as your ExecJS runtime. One way to do so:
Install nodejs
Set an environment varaible EXECJS_RUNTIME to Node
Start up your Rails server
Alternative fix: modify existing configuration
Alternative to making another installation (NodeJS) is to modify the configuration of your default ExecJS runtime. I believe your system is using cscript.
Have a look at your execjs runtimes.rb file. (It is in your gems directory.) You can see the latest version of this file on github here. It contains the following:
JScript = ExternalRuntime.new(
name: "JScript",
command: "cscript //E:jscript //Nologo //U",
runner_path: ExecJS.root + "/support/jscript_runner.js",
encoding: 'UTF-16LE' # CScript with //U returns UTF-16LE
)
I can't advise you on the best course to take, but for the sake of getting a fix in place quickly, you may want to just edit this file (then restart your server).
You may find that removing the //U fixes the problem.
You may find that changing UTF-16LE to UTF-8 fixes the problem.
You may find that the combination of both of these steps fixes the problem.
These instructions are drawn from ExecJS::RuntimeError on Windows trying to follow rubytutorial