Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

`require': cannot load such file -- typhoeus #1633

Open
adrian-gomez opened this issue Jan 13, 2025 · 7 comments
Open

`require': cannot load such file -- typhoeus #1633

adrian-gomez opened this issue Jan 13, 2025 · 7 comments
Labels
lib/ruby Ruby client library

Comments

@adrian-gomez
Copy link

Bug Report

Version

ruby svix-1.56.0

Platform

OSx

Description

It seems the hard requirement for typhoeus was reintroduced by mistake (?)
The PR #1486 made it optional but I just tried to add svix to our project and got the error in the title when trying to run any rails command.

The require comes from lib/svix.rb#L82 -> lib/svix/api_client.rb#L18

We only plan to validate webhooks so we don't want to the extra dependency if we can avoid it.

@tasn
Copy link
Member

tasn commented Jan 13, 2025

Oh, what you're saying is that even though you only plan on using Svix for webhook verification, it's still causing issues for you?

I don't think it was reintroduced (have we even made any changes to the lib since?), but maybe the previous solution wasn't sufficient?

Any idea what we should do to fix it? I don't know Ruby myself, so not sure what's the right solution here. Though how do we make that import path that you shared be optional? (so it doesn't import api_client unless you use it).

@tasn tasn added the lib/ruby Ruby client library label Jan 13, 2025
@msantam2
Copy link

msantam2 commented Jan 15, 2025

Just chiming in that I'm having the exact same issue -- just making a note that yes, adding typhoeus gem to the Gemfile did resolve this issue - but agreed I'd prefer to not have this dependency in the project if I don't need it

@tasn
Copy link
Member

tasn commented Jan 15, 2025

We had it, but removed it following a PR from the community (#1486).

Any suggestions on how to resolve this? CC @jjb

@jjb
Copy link
Contributor

jjb commented Jan 15, 2025

lib/svix/api_client.rb is not in the repo, it is generated by this:

begin
require 'typhoeus'
rescue LoadError
raise <<~MESSAGE
To use svix for sending outgoing webhooks, you need to install the typheous gem.
Please add it to your Gemfile and then run `bundle install`:
gem 'typhoeus'
MESSAGE
end

so the error message should be different from what @adrian-gomez is experiencing

looking at the published gem:

→ gem install svix
➔ gem which svix
..../gems/svix-1.56.0/lib/svix.rb

looking at ...gems/svix-1.56.0/lib/svix/api_client.rb

we have this at the top

require 'date'
require 'json'
require 'logger'
require 'tempfile'
require 'time'
require 'typhoeus'

so, something in the openapi-generator stack is adding that to the top even though it's not in the template.

@tasn
Copy link
Member

tasn commented Jan 15, 2025

Thanks @jjb!

We are in the process of changing how the Ruby code is generated anyway, so I think it'll probably fix itself in the next 7-10 days.

Is there a way to make the api part optional? As in, only make the typeoeus import happen if someone is actually using it?

@jjb
Copy link
Contributor

jjb commented Jan 15, 2025

need to someone make this optional

require "svix/api_client"

a silly way to do that is only require it if typhoeus is installed... may find yourself with confused users

@tasn
Copy link
Member

tasn commented Jan 15, 2025

OK, I think we'll just wait until the Ruby lib overhaul @svix-mman and @svix-jplatte are working on.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lib/ruby Ruby client library
Projects
None yet
Development

No branches or pull requests

4 participants