Closed jamie-b5 closed 2 months ago
There seems to be two main errors showing in your log file:
[2024-04-08 14:55:19] production.ERROR: file_put_contents(C:\laragon\www\servers\statamic-staging\sound_org\storage\framework/cache/data/stache/indexes/entries/orders/status_log->paid): Failed to open stream: No such file or directory {"exception":"[object] (ErrorException(code: 0): file_put_contents(C:\\laragon\\www\\servers\\statamic-staging\\sound_org\\storage\\framework/cache/data/stache/indexes/entries/orders/status_log->paid): Failed to open stream: No such file or directory at C:\\laragon\\www\\servers\\statamic-staging\\sound_org\\vendor\\laravel\\framework\\src\\Illuminate\\Filesystem\\Filesystem.php:205)
[2024-04-08 16:31:10] local.ERROR: Unable to create lockable file: C:\laragon\www\servers\statamic-staging\sound_org\storage\framework/cache/data/78/db/78db7c35b7728ea67bf8a0c1cca8882690774592. Please ensure you have permission to create files in this location.
It looks like Laravel is having issues reading/writing to the cache files. I've never used Laragon before but maybe one these issues might be helpful:
If Laravel is unable to read/write to the cache (which is where Statamic's Stache lives), it'd make sense that things might be going in a loop or taking longer than expected, which could be the cause of both issues you're experiencing.
Hi Duncan
Thanks for the response.
I have reset all the local permissions and my laravel.log is now no longer reporting these errors.
However I still have the same 2 problems.
When I try to run the php please sc:run-update-scripts command it appears to hang/make no progress
Secondly the cart is still showing the same generic error.
Interestingly it is not the cart url but rather a lower level simple-commerce route that is reporting the error /!/simple-commerce/cart-items
I have checked the routes and this should be available
but the error reported in the browser inspector response pane is Failed to load response data: no resource with given identifier found
Any ideas?
Are there any other errors being logged in your log file?
Just checked the laravel.log again and found this - I assume this is because I cannot run the post install scripts which would address this?
[2024-04-09 15:39:44] local.ERROR: Object of class DuncanMcClean\SimpleCommerce\Orders\StatusLogEvent could not be converted to string {"userId":"1af9034f-aa03-4e42-812c-81211b489e90","exception":"[object] (Error(code: 0): Object of class DuncanMcClean\\SimpleCommerce\\Orders\\StatusLogEvent could not be converted to string at C:\\laragon\\www\\servers\\statamic-staging\\sound_org\\vendor\\nesbot\\carbon\\src\\Carbon\\Traits\\Creator.php:604)
Can you provide the full stack trace so I can see where the error is coming from?
Apologies, see attached Laravel log file
Thanks! Are you also able to provide your order blueprint?
Absolutely - much appreciated.
title: Order
tabs:
main:
display: Main
sections:
-
fields:
-
handle: title
field:
type: text
required: false
width: 50
validate:
- required
-
handle: customer
field:
max_items: 1
mode: default
collections:
- customers
type: entries
listable: true
display: Customer
width: 50
instructions_position: above
create: true
visibility: read_only
-
handle: tracking_ref
field:
input_type: text
antlers: false
display: 'Tracking Ref'
type: text
icon: text
instructions: 'Add the tracking ref - this will be included in the customer shipping notification.'
listable: hidden
instructions_position: above
visibility: visible
-
handle: order_number
field:
type: hidden
-
handle: totals
field:
display: Totals
type: section
icon: section
listable: hidden
instructions_position: above
-
handle: items_total
field:
type: money
display: 'Items Total'
read_only: true
validate: required
save_zero_value: true
width: 33
listable: hidden
instructions_position: above
visibility: read_only
-
handle: coupon_total
field:
type: money
display: 'Coupon Total'
read_only: true
validate: required
save_zero_value: true
width: 33
listable: false
visibility: read_only
-
handle: tax_total
field:
type: money
display: 'Tax Total'
read_only: true
validate: required
save_zero_value: true
width: 33
listable: false
visibility: read_only
-
handle: shipping_total
field:
type: money
display: 'Shipping Total'
read_only: true
validate: required
save_zero_value: true
width: 33
listable: false
visibility: read_only
-
handle: grand_total
field:
type: money
display: 'Grand Total'
read_only: true
validate: required
save_zero_value: true
width: 33
listable: true
instructions_position: above
visibility: read_only
-
handle: order_details
field:
display: 'Order Details'
type: section
icon: section
listable: hidden
instructions_position: above
-
handle: items
field:
fields:
-
handle: id
field:
type: hidden
listable: hidden
display: ID
-
handle: product
field:
max_items: 1
mode: default
collections:
- products
type: entries
listable: hidden
display: Product
validate: required
width: 50
read_only: true
-
handle: variant
field:
display: Variant
type: product_variant
icon: product_variant
width: 50
listable: hidden
read_only: true
-
handle: quantity
field:
input_type: number
type: text
listable: hidden
display: Quantity
width: 50
read_only: true
-
handle: total
field:
type: money
listable: hidden
display: Total
validate: required
width: 50
read_only: true
-
handle: metadata
field:
mode: dynamic
display: Metadata
type: array
icon: array
listable: hidden
read_only: true
-
handle: tax
field:
type: sc_line_items_tax
mode: stacked
reorderable: false
type: grid
listable: false
display: 'Line Items'
min_rows: 1
add_row: 'Add Line Item'
-
handle: coupon
field:
max_items: 1
mode: default
type: coupon
listable: false
display: Coupon
width: 50
visibility: read_only
-
handle: shipping_method
field:
display: 'Shipping Method'
type: shipping_method
width: 50
visibility: read_only
shipping_address:
display: 'Shipping Address'
sections:
-
fields:
-
handle: shipping_name
field:
input_type: text
type: text
listable: false
display: 'Shipping Name'
visibility: read_only
-
handle: shipping_address
field:
input_type: text
type: text
listable: false
display: 'Shipping Address Line 1'
width: 50
antlers: false
visibility: read_only
-
handle: shipping_address_line2
field:
input_type: text
antlers: false
display: 'Shipping Address Line 2'
type: text
icon: text
width: 50
listable: hidden
visibility: read_only
-
handle: shipping_city
field:
input_type: text
type: text
listable: false
display: 'Shipping City'
width: 50
visibility: read_only
-
handle: shipping_postal_code
field:
input_type: text
type: text
width: 50
listable: false
display: 'Shipping Postal Code'
visibility: read_only
-
handle: shipping_region
field:
max_items: 1
mode: default
display: 'Shipping Region'
type: region
icon: region
width: 50
listable: hidden
visibility: read_only
-
handle: shipping_country
field:
max_items: 1
mode: default
display: 'Shipping Country'
type: country
icon: country
listable: hidden
width: 50
visibility: read_only
billing_address:
display: 'Billing Address'
sections:
-
fields:
-
handle: use_shipping_address_for_billing
field:
type: toggle
listable: false
display: 'Use Shipping Address for Billing?'
default: true
instructions_position: above
visibility: read_only
-
handle: billing_name
field:
input_type: text
type: text
listable: false
display: 'Billing Name'
unless:
use_shipping_address_for_billing: 'equals true'
visibility: read_only
-
handle: billing_address
field:
input_type: text
type: text
listable: false
display: 'Billing Address Line 1'
width: 50
antlers: false
unless:
use_shipping_address_for_billing: 'equals true'
visibility: read_only
-
handle: billing_address_line2
field:
input_type: text
antlers: false
display: 'Billing Address Line 2'
type: text
icon: text
width: 50
listable: hidden
unless:
use_shipping_address_for_billing: 'equals true'
visibility: read_only
-
handle: billing_city
field:
input_type: text
type: text
listable: false
display: 'Billing City'
unless:
use_shipping_address_for_billing: 'equals true'
width: 50
visibility: read_only
-
handle: billing_postal_code
field:
input_type: text
type: text
width: 50
listable: false
display: 'Billing Postal Code'
unless:
use_shipping_address_for_billing: 'equals true'
visibility: read_only
-
handle: billing_region
field:
max_items: 1
mode: default
display: 'Billing Region'
type: region
icon: region
width: 50
listable: hidden
unless:
use_shipping_address_for_billing: 'equals true'
visibility: read_only
-
handle: billing_country
field:
max_items: 1
mode: default
display: 'Billing Country'
type: country
icon: country
listable: hidden
unless:
use_shipping_address_for_billing: 'equals true'
width: 50
visibility: read_only
sidebar:
display: Sidebar
sections:
-
fields:
-
handle: slug
field:
type: hidden
localizable: true
display: Slug
icon: hidden
listable: false
validate:
- required
visibility: read_only
-
handle: payment
field:
display: Payment
type: section
icon: section
listable: hidden
instructions_position: above
-
handle: is_paid
field:
type: toggle
listable: false
display: 'Is Paid?'
visibility: read_only
-
handle: paid_date
field:
mode: single
time_enabled: true
time_required: true
earliest_date: '1900-01-01'
full_width: false
inline: false
columns: 1
rows: 1
type: date
listable: true
display: 'Paid At'
instructions_position: above
time_seconds_enabled: false
visibility: read_only
hide_display: false
-
handle: gateway
field:
display: Gateway
type: gateway
visibility: read_only
-
handle: order_status
field:
type: order_status
display: 'Order Status'
read_only: true
validate: required
visibility: read_only
-
handle: payment_status
field:
type: payment_status
display: 'Payment Status'
read_only: true
validate: required
visibility: read_only
-
handle: status_log
field:
type: sc_status_log
display: 'Status Log'
-
handle: placed_date
field:
mode: single
inline: false
full_width: false
columns: 1
rows: 1
time_enabled: false
time_seconds_enabled: false
type: date
display: 'Order Date'
icon: date
listable: true
instructions_position: above
visibility: computed
hide_display: false
-
handle: dispatched_date
field:
mode: single
inline: false
full_width: false
columns: 1
rows: 1
time_enabled: false
time_seconds_enabled: false
type: date
display: 'Dispatched Date'
icon: date
listable: hidden
instructions_position: above
visibility: computed
hide_display: false
Can you remove the paid_date
/placed_date
/dispatched_date
fields to see if that fixes the issue?
After migrating, the "Status Log" field will give you the relevant dates for each of the statuses.
Yep, I'll do that now and report back.
Hi Duncan
Removed the date fields from the blueprint. Cleared the cache and loaded the Orders index in the control panel which gave me the same fault as we saw in the Laravel log ( I think).
The original issue with the checkout remains and I have tried to run the post install scripts again but this still seems to hang or make no discernible progress,
I notice they were computed fields - did you remove the computed logic in your AppServiceProvider
?
Simple Commerce v6 changed how the order "status log" works behind the scenes, so custom code that worked on v5, like computed fields may no longer work (or be necessary).
If that doesn't help, are you able to add me to your site's repository and I can take a look when I have some time?
Good catch!
Yes, I'm now seeing the orders again in the cp
Is there instruction on handling the Status Log array to display as individual fields?
I'm still seeing the generic 500 error when I add a product to the cart, unfortunately. And the post install scripts do not seem to make any progress.
If that doesn't help, are you able to add me to your site's repository and I can take a look when I have some time?
Just seen this last comment. Our normal dev flow doesn't use git hub (we use git from our local dev -> staging -> production) - but I can speak to my boss and see if he is happy for us to push to a github repo. I assume that is what you meant?
Thanks again.
Is there instruction on handling the Status Log array to display as individual fields?
I'd actually probably recommend doing it the way you were with the computed fields but the code in the computed fields probably needs to be tweaked.
Just seen this last comment. Our normal dev flow doesn't use git hub (we use git from our local dev -> staging -> production) - but I can speak to my boss and see if he is happy for us to push to a github repo. I assume that is what you meant?
Yeah, either that or just emailing me a zip file containing the site (my email is duncan@doublethree.digital). Thanks!
Fab! I'll send you something shortly.
Thanks - got it! I'll take a look when I'm able.
Released as part of v6.1.0.
Thanks for providing your site! Looks like orders with deleted product line items were causing an infinite loop - updating to the latest version should fix it.
If you run into any other issues, please open a new issue. Thanks!
Thanks a lot for your time and support! Much appreciated.
Jamie
Description
I upgraded our Simple Commerce version from 5.9.2 to 6.0.11 with the help of Duncan and the upgrade guide.
This was to try to resolve a problem with the tax calculations in the cart. See https://github.com/duncanmcclean/simple-commerce/issues/1038.
The version of Simple Commerce appears to have successfully updated.
We now experience a generic 500 error when trying to add a product to the cart.
There is no further detail given for the error on screen (despite the APP_DEBUG being set to true).
I have attached our laravel.log file in case this offers any further clues, although I cannot see anything immediately obvious.
laravel.log
I also noticed that the update scripts run but appear to hang. There are 163 orders in our app (static files not db). I left this running for several hours but it did not complete.
Steps to reproduce
Environment
Environment
Application Name: Sound Organisation
Laravel Version: 10.22.0
PHP Version: 8.1.10
Composer Version: 2.4.1
Environment: local
Debug Mode: ENABLED
URL: sound_org.test
Maintenance Mode: OFF
Cache
Config: NOT CACHED
Events: NOT CACHED
Routes: NOT CACHED
Views: NOT CACHED
Drivers
Broadcasting: log
Cache: statamic
Database: mysql
Logs: stack / single
Mail: smtp
Queue: sync
Session: file
Simple Commerce
Currencies: GBP
Gateways: Stripe
Repository: Customer: DuncanMcClean\SimpleCommerce\Customers\EntryCustomerRepository
Repository: Order: DuncanMcClean\SimpleCommerce\Orders\EntryOrderRepository
Repository: Product: DuncanMcClean\SimpleCommerce\Products\EntryProductRepository
Shipping Methods: Free Overnight Shipping, Click and Collect
Tax Engine: DuncanMcClean\SimpleCommerce\Tax\Standard\TaxEngine
Statamic
Addons: 3
Antlers: runtime
Sites: 1
Stache Watcher: Disabled
Static Caching: Disabled
Version: 4.55.0 PRO
Statamic Addons
duncanmcclean/simple-commerce: 6.0.11
jezzdk/statamic-google-maps: 1.2.2
rias/statamic-data-import: 1.3.0