Hello I am trying to setup my local env to work on...
# support
l
Hello I am trying to setup my local env to work on the solidus_stripe extension. I’d like a confirmation from one of the devs currently working on it @ Elia or @ waiting_for_dev maybe. I managed to have the app running, I set the env variables. You confirm that in this page, I should have the Stripe checkout form displayed instead of the “loading…” no ?
e
yes, at that point the payment element form should show up, any message in the browser console?
l
Copy code
caught TypeError: Failed to resolve module specifier "application". Relative references must start with either "/", "./", or "../".
I’ll dig around that
e
it looks like something didn’t work in the JS setup loading stimulus
is this a freshly created app? maybe it had
--skip-javascript
?
l
it’s the sandbox created via bin/dev
e
🤔 then I would check the output of the creation, maybe something went wrong there, would you mind deleting the
sandbox
dir and retrying?
l
I might have messed up or forgot some commands during setup
still the same, it’s on the whole site, I haven’t noticed any other bugs, not sure if it is the cause. I’ll do few tests before pinging you again if needed.
e
@loic mind sharing the output of calling
bin/sandbox
?
l
I have to go for ~1h30. but I’ll do that.
🙌 1
Copy code
{12:52}[ruby-3.2.0@solidus_stripe]~/projects/clients/epicery/solidus_stripe:loicginoux/274-make-factory-publicly-available ✗ ➭ bin/sandbox
~~> Using cached rails sandbox
~~> Running: bundle install
Bundle complete! 37 Gemfile dependencies, 156 gems now installed.
Use `bundle info [gemname]` to see where a bundled gem is installed.
~~> Running: bundle add solidus_stripe --path ..
Fetching gem metadata from <https://rubygems.org/>........
Resolving dependencies...
Fetching gem metadata from <https://rubygems.org/>........
Resolving dependencies...
~~> Running: bundle exec rails generate solidus_stripe:install --migrate --specs=all
     install  [solidus_stripe] migrations
        rake    railties:install:migrations FROM=solidus_stripe
Copied migration 20230420105259_create_solidus_stripe_payment_sources.solidus_stripe.rb from solidus_stripe
Copied migration 20230420105260_create_solidus_stripe_setup_intent.solidus_stripe.rb from solidus_stripe
Copied migration 20230420105261_create_solidus_stripe_payment_intents.solidus_stripe.rb from solidus_stripe
Copied migration 20230420105262_create_solidus_stripe_webhook_endpoints.solidus_stripe.rb from solidus_stripe
Copied migration 20230420105263_add_payment_method_reference_to_stripe_intents.solidus_stripe.rb from solidus_stripe
Copied migration 20230420105264_normalize_stripe_intent_id_attributes.solidus_stripe.rb from solidus_stripe
Copied migration 20230420105265_create_solidus_stripe_customers.solidus_stripe.rb from solidus_stripe
Copied migration 20230420105266_drop_solidus_stripe_setup_intent.solidus_stripe.rb from solidus_stripe
Copied migration 20230420105267_rename_webhook_endpoint_to_payment_method_slug_entries.solidus_stripe.rb from solidus_stripe
         run    bin/rails db:migrate from "."
== 20230420105259 CreateSolidusStripePaymentSources: migrating ================
-- create_table(:solidus_stripe_payment_sources)
   -> 0.0016s
== 20230420105259 CreateSolidusStripePaymentSources: migrated (0.0017s) =======

== 20230420105260 CreateSolidusStripeSetupIntent: migrating ===================
-- create_table(:solidus_stripe_setup_intents)
   -> 0.0017s
== 20230420105260 CreateSolidusStripeSetupIntent: migrated (0.0017s) ==========

== 20230420105261 CreateSolidusStripePaymentIntents: migrating ================
-- create_table(:solidus_stripe_payment_intents)
   -> 0.0014s
== 20230420105261 CreateSolidusStripePaymentIntents: migrated (0.0014s) =======

== 20230420105262 CreateSolidusStripeWebhookEndpoints: migrating ==============
-- create_table(:solidus_stripe_webhook_endpoints)
   -> 0.0019s
== 20230420105262 CreateSolidusStripeWebhookEndpoints: migrated (0.0019s) =====

== 20230420105263 AddPaymentMethodReferenceToStripeIntents: migrating =========
-- add_reference(:solidus_stripe_setup_intents, :payment_method, {:null=>false, :foreign_key=>{:to_table=>:spree_payment_methods}})
   -> 0.0182s
-- add_reference(:solidus_stripe_payment_intents, :payment_method, {:null=>false, :foreign_key=>{:to_table=>:spree_payment_methods}})
   -> 0.0232s
== 20230420105263 AddPaymentMethodReferenceToStripeIntents: migrated (0.0415s)

== 20230420105264 NormalizeStripeIntentIdAttributes: migrating ================
-- rename_column(:solidus_stripe_payment_intents, :stripe_payment_intent_id, :stripe_intent_id)
   -> 0.0107s
-- rename_column(:solidus_stripe_setup_intents, :stripe_setup_intent_id, :stripe_intent_id)
   -> 0.0090s
== 20230420105264 NormalizeStripeIntentIdAttributes: migrated (0.0197s) =======

== 20230420105265 CreateSolidusStripeCustomers: migrating =====================
-- create_table(:solidus_stripe_customers)
   -> 0.0021s
== 20230420105265 CreateSolidusStripeCustomers: migrated (0.0022s) ============

== 20230420105266 DropSolidusStripeSetupIntent: migrating =====================
-- drop_table("solidus_stripe_setup_intents", {:force=>:cascade})
   -> 0.0009s
== 20230420105266 DropSolidusStripeSetupIntent: migrated (0.0009s) ============

== 20230420105267 RenameWebhookEndpointToPaymentMethodSlugEntries: migrating ==
-- rename_table(:solidus_stripe_webhook_endpoints, :solidus_stripe_slug_entries)
   -> 0.0078s
== 20230420105267 RenameWebhookEndpointToPaymentMethodSlugEntries: migrated (0.0078s)

     install  [solidus_stripe] solidus_core
       exist    config/initializers
      create    config/initializers/solidus_stripe.rb
       route    mount SolidusStripe::Engine, at: '/solidus_stripe'
     install  [solidus_stripe] solidus_backend
      append    vendor/assets/javascripts/spree/backend/all.js
      insert    vendor/assets/stylesheets/spree/backend/all.css
     install  [solidus_stripe] solidus_starter_frontend
       exist    app
      create    app/assets/stylesheets/spree/frontend/solidus_stripe.css
      create    app/javascript/controllers/solidus_stripe_confirm_controller.js
      create    app/javascript/controllers/solidus_stripe_payment_controller.js
      create    app/views/checkouts/existing_payment/_stripe.html.erb
      create    app/views/checkouts/existing_payment/stripe/_card.html.erb
      create    app/views/checkouts/existing_payment/stripe/_default.html.erb
      create    app/views/checkouts/payment/_stripe.html.erb
      create    app/views/orders/payment_info/_stripe.html.erb
      insert    app/assets/stylesheets/solidus_starter_frontend.css
       exist    spec
      create    spec/lib/solidus_stripe/configuration_spec.rb
      create    spec/lib/solidus_stripe/money_to_stripe_amount_converter_spec.rb
      create    spec/lib/solidus_stripe/refunds_synchronizer_spec.rb
      create    spec/lib/solidus_stripe/seeds_spec.rb
      create    spec/lib/solidus_stripe/webhook/event_spec.rb
      create    spec/models/concerns/solidus_stripe/log_entries_spec.rb
      create    spec/models/solidus_stripe/customer_spec.rb
      create    spec/models/solidus_stripe/gateway_spec.rb
      create    spec/models/solidus_stripe/payment_intent_spec.rb
      create    spec/models/solidus_stripe/payment_method_spec.rb
      create    spec/models/solidus_stripe/payment_source_spec.rb
      create    spec/requests/solidus_stripe/intents_controller_spec.rb
      create    spec/requests/solidus_stripe/webhooks_controller/charge/refunded_spec.rb
      create    spec/requests/solidus_stripe/webhooks_controller/payment_intent/canceled_spec.rb
      create    spec/requests/solidus_stripe/webhooks_controller/payment_intent/payment_failed_spec.rb
      create    spec/requests/solidus_stripe/webhooks_controller/payment_intent/succeeded_spec.rb
      create    spec/requests/solidus_stripe/webhooks_controller_spec.rb
      create    spec/solidus_stripe_spec_helper.rb
      create    spec/subscribers/solidus_stripe/webhook/charge_subscriber_spec.rb
      create    spec/subscribers/solidus_stripe/webhook/payment_intent_subscriber_spec.rb
      create    spec/support/solidus_stripe/backend_test_helper.rb
      create    spec/support/solidus_stripe/checkout_test_helper.rb
      create    spec/support/solidus_stripe/factories.rb
      create    spec/support/solidus_stripe/webhook/data_fixtures.rb
      create    spec/support/solidus_stripe/webhook/event_with_context_factory.rb
      create    spec/support/solidus_stripe/webhook/request_helper.rb
      create    spec/system/backend/solidus_stripe/orders/payments_spec.rb
      create    spec/system/frontend/.keep
      create    spec/system/frontend/solidus_stripe/checkout_spec.rb
         run    bin/importmap pin @stripe/stripe-js from "."
        load  seed data
      append  db/seeds.rb
Creating refund reason for Stripe refunds
~~> Creating the stripe payment method using env credentials...
~~> Running: bundle exec rails runner p SolidusStripe::PaymentMethod.create!(name: "SolidusStripe", preference_source: "solidus_stripe_env_credentials", position: -1)
#<SolidusStripe::PaymentMethod id: 4, type: "SolidusStripe::PaymentMethod", name: "SolidusStripe", description: nil, active: true, deleted_at: nil, created_at: "2023-04-20 10:53:05.565928000 +0000", updated_at: "2023-04-20 10:53:05.565928000 +0000", auto_capture: nil, preferences: {}, preference_source: "solidus_stripe_env_credentials", position: 1, available_to_users: true, available_to_admin: true, type_before_removal: nil>
I can screenshot if it’s more readable
just in case
thanks. I’ll finally be able to work on some solidus_stripe PR’s 😅 even if you already made a lot of progress !
❤️ 1
e
@loic can you try
bin/sandbox
again after removing the
tmp/cache/rails-new
folder? maybe something went wrong with that cache
k
@elia don’t we have a command to regenerate a fresh sandbox?
e
we do, it’s bin/sandbox, but we also recently started to cache the (time consuming)
rails new …
section of it
k
Oh right, I think we should have at least a parameter to really have a fresh application
l
still the same error after cleaning
Copy code
rm -rf tmp/cache/rails-new && rm -rf sandbox && bin/sandbox
could you tell me if you have this line highlighted in your html header ?
Copy code
<script type="module">import "application"</script>
p
Following along.. just checked out the main branch, and can’t reproduce this. Looks like it’s working for me
l
the importmap is empty, It could be the issue
could you screenshot your html head please ?
p
l
could you open the script type importmap ? and let me know what’s inside. Yours seems to have some content and be generated correctly
p
this is on payment step on the checkout:
👍 1
l
thanks, that will be my issue, I’ll check why it does not generated the importmap. (it’s on any page not just payment)
p
yeah, it looks like that’s the issue indeed.
not sure why though.. I’m running Brave browser and ruby 3.2.2
have to run now, but back in about 1h. Invested to make this work!
e
@loic you can try
cd sandbox; bin/importmap json
and also check the contents of
sandbox/config/importmap.rb
l
I am at this point yes…
env: ./bin/importmap: No such file or directory
k
has the sandbox been generated with rails 7?
e
also check if there’s any
~/.railsrc
file lying around
l
So starting from a clean rvm gemset, and a clean tmp/rails-cache, I saw few errors I missed during bin/sandbox.
after running manually
rails  importmap:install
and
rails  turbo:install stimulus:install
it seems like I am having the correct importmap.
k
seems related to bootsnap
l
Thank you, I suppose it’s something about my ruby env, I cannot find a way to make this bootsnap error go away during sandbox install, running the 2 commands above manually in sandbox fixed my problem and I have the stripe checkout displayed during checkout 👍
e
@loic nesting a rails app inside the repo is likely to be part of the issue here, especially related to the two bundler-layers, if you can find a tweak in the bin/sandbox script that will make it work we can incorporate it, I also suggest to check if updating rubygems/bundler will fix it
l
I realized that the rvm gemset ruby3.2@solidus_stripe I used at the root level of the extension was not used in sandbox, but even with the same rvm env (ruby3-2 default gemset) for both app, it was stil an issue, even when having installed previously the gem bootsnap manually. I’ll try next time with an up to date bundler version (currently at Bundler version 2.4.1)