cancel
Showing results for 
Search instead for 
Did you mean: 

Magento 2.4 extension not working (Solved)

Swappart
Contributor

Trying to integrate Shipstation with Magento 2.4.4. The extension is version 2.3.1 from the Magento marketplace. I'm getting the following error in the admin area.

 

Deprecated Functionality: error_log(): Passing null to parameter #1 ($message) of type string is deprecated in /home/public_html/magento/vendor/auctane/api/Model/NoConfigNotification.php on line 32

 

Looking at NoConfigNotification.php, I can see the configuration is supposed to be done from my shipstation.com account. I have tried setting up the store integration there, but I get a 404 error. I can see the APIs in swagger. I'm able to manually hit the GET API (v1/auctane/configure). I figured out from looking at Authenticator.php that I needed to pass 'ShipStation-Access-Token' in the header with the generated api key as it's value. I tried with cURL and get a 200 OK. I'm also able to hit the POST API and pass dummy values which make the above error go away. So, it seems the APIs are working. I'm not sure why Shipstation is getting a 404. Any ideas how to get this working?

47 REPLIES 47

sales142
Contributor

Well we were able to get the Magento Admin side working... and we've got our connection (sort of) successfully made between Magento 2.4.4 and ShipStation. But there's more problems.... let's say you DO get your Magento installation connected to ShipStation you are still going to face an uphill battle:

auctane_api.ERROR: Deprecated Functionality: trim(): Passing null to parameter #1 ($string) of type string is deprecated in /chroot/home/xxxxx/vendor/auctane/api/Model/Action/Export.php on line 312

ShipStation hasn't made much of an effort to help Magento users fix these problems. We connected immediately and without any issues via ShippingEasy but their system is worse than ShipStation. No APP. Unable to send shipment notification emails for "MARK AS SHIPPED" orders. As much as we hate ShipStation V3 we'd love to stick around if we can get Magento 2.4.4 working properly. If not we've got to move on until ShipStation can get their act together.

 

Aloha

It seems like maybe I have an API missing. When I test the connection, I get 'GET /index.php/api/auctane?action=export&start_date=06%2f20%2f2022+21%3a33&end_date=06%2f20%2f2022+21%3a38&page=1' written to my SSL log. /index.php/api/auctane seems to be the page which isn't found. I was using Easyship, but I got frustrated with it because everytime I needed to use it, I would have to reset the API connection.

sales142
Contributor

Can't help with the module install. Via Composer it went pretty smooth for us. No different than any other module. Unfortunately it still doesn't work. 😂

Search the interwebz and you'll find no shortage of Magento users that have MADE IT WORK eventually but it sure would be nice to have a working module for 2.4.4 right out of the box. OR... do what ShippingEasy does and skip the crap and just go straight to a User / Password approach. That makes it relatively easy to get going but the ShippingEasy product is weak sauce compared to the features ShipStation offers (when it works).

 

Aloha

I also installed with Composer. No apparent problems there. It just doesn't work. I'll keep trying. 

sales142
Contributor

Unfortunately the "support" that ShipStation is going to give you by email will most likely be next to useless. I think the ShipStation support employees make the minimum effort but it's hard to blame them as they aren't Magento Developers. Magento is downright difficult and one semicolon in the wrong spot brings down the house. I'm hoping that some Moderator will see the length of this thread and make a call to the person within ShipStation (or whatever agency they use for development) and get this fixed. An option we're exploring is to hire a professional Magento developer (we aren't pros, we run our own site because we're cheap) and get this fixed but that's a last resort.

 

Aloha

That sounds expensive. I'll probably just go back to easyShip. It may have been frustrating to have to reset the connection all the time, but at least it was functional. This kind of makes me mad because we pay a monthly fee for the service. They spend millions on TV ads. They need to put some money into making their products compatible with the platforms they advertise them for.

I got it working. The problem is that Shipstation puts index.php in the URL. So, when testing the connection, it's trying to get mysite.com/index.php/api/auctane, but the API is at mysite.com/api/auctane. I put a redirect in my vhost file and it works now. That's not to say everything works, but just that I was able to connect my store. Now I'll see what the next issue is.

Have you been able to pull order data from the Magento site into ShipStation yet? Connection was the easy part for us... getting it to actually retrieve data has proven less so.

 

Aloha

Can't say for certain because I have no orders. I'll try doing a test buy tomorrow. Right now, the issue seems to be Shipstation trying to POST to /index.php/rest/V1/auctane/configure but the API is at /rest/V1/auctane/configure. Can't redirect a POST request, so I'm trying to get rewrite to change it.

Fixed it. Added the following rewrite rules in my servers vhosts.conf file (could also be done in .htaccess). If a request comes in with index.php in the url, it redirects it without the index.php.

RewriteCond %{REQUEST_URI} ^/index.php/
RewriteRule (.*)index\.php/(.*) /$2 [L,R=307,NC,QSA]

 

Doesn't seem to be importing orders yet. I'll tackle that next.

Doesn't seem to be importing orders yet. I'll tackle that next.

 

That's the fun part.

 

Aloha

I'm making progress. The initial error I posted above (Deprecated Functionality: error_log(): Passing null to parameter #1...) was caused by the POST API rest/all/V1/auctane/configure not being available when I set up Checkout Rates under Store Setup ->MyStore->Edit Store Details. I knew from my logs that a POST request had tried to access that API yesterday. This is something which seems to only happen once. If it fails, there is no way to reset it and try again. What it does is it sets the 3 config variables. Those variables are rates_url, option_key, and marketplace_key. The rates_url is the shipping rates API endpoint. The other 2 variables seem to be identifiers for something. The main thing is, nothing works if these aren't set. To get this to work, I set my store to inactive and then clicked the 'Connect a Store or Marketplace' button and just created a new store integration. As soon as I set up the Checkout Rates, it set the 3 config variables in the database. It sucks having to set it all up again, but aside from putting in a support ticket, I think it was the only way. It still isn't importing orders, but with the other error out of the way, I can figure out what the issue is. BTW, I've been developing my own business software for years. I usually work with Java and C#. I'm new to Magento, and I haven't worked with PHP much, but with enough time and patience, I can figure anything out. Troubleshooting is something I'm good at.

What's odd is your initial setup seems to have been fraught with issues... and ours was relatively simple to connect. We've tried disconnecting the store on the ShipStation side and then creating a new connection and the "test connection" works just fine. We created a new connection with the hope it would import data... any data. NOPE. Zero, zilch, nada pinata. It doesn't even throw us an error to look for.

 

Aloha

It could just be related to my server configuration. Are you on Magento 2.4.4 and ShipStation 2.3.1? I just found an error in auctane/api/Model/Action/Export.php. The variable _attributes is null, and shouldn't be. This is probably why it's not exporting orders. In the database table 'core_config_data' under path is 'shipstation_general/shipstation/attribute'. The corresponding value is null, and that is what Export.php is looking for.

 

Edit: That was an easy one. In Magento->Configuration->ShipStation->General Settings, you just have to select some attributes in the Export custom attributes as custom options section. Still not exporting orders though.

 

Got it! In Magento, go to your orders and click view. On the order page, at the top, click ship. That opens the New Shipment page. At the bottom, click Submit Shipment. Now go to ShipStation and the order will import. Pending orders don't import. They have to be processing. Maybe there's an easier way, like some setting to make them automatically set to processing. Also, as I mentioned in the previous post, if you don't have any attributes selected it throws an error and probably won't export. So, select some attributes even if you don't intend to use them.

That's a weird workflow... in the past we never had do change the status. When an order is placed the payment has already been "authorized" so the order status for a new order defaults to Processing which is an attribute that ShipStation recognizes. Telling the system "Submit Shipment" doesn't seem like the correct way to go about it. Just for giggles I created a dummy order and did as you mentioned... viewed the order and hit Submit Shipment. Went back to ShipStation and performed another manual refresh and there was nothing there.

 

Aloha

Did you select some attributes as I said in the previous post? If none are selected, it causes an error in the export script.

I'm not exactly sure where or which attributes you are referring to. These settings within ShipStation? If not... can you screenshot what you are talking about?

Many Mahalos!shipstation_1.png

In Magento. Under ShipStation in configuration.

 

settings.JPG

Scratch that... I see what you are saying. And it worked!

I deleted all of the "Export custom attributes as custom options" selections and saved. Cleaned / Flushed Cache. Then went back and added a few. Saved. Then went back to ShipStation and voila! Something happened. 😉

ShipStation owes you a credit. Now we need to un-cancel our cancellation. 😉

Aloha

Awesome! It's really dumb that it fails if no attributes are selected. I'm going to continue trying to find a better option than having to manually create shipments. That's just too much work.

So in our configuration we do NOT have to manually create anything. If you go back to my screenshot you should see that "processing" is a state that allows the import of an order. What is the status of your order as created? Are you just testing with "Fake" orders? If so... you might have to tinker with the initial status of the order when Magento receives and posts it.

Say you place a new "Telephone" order from the frontend. It will sit there in limbo in the eyes of ShipStation because it's not in processing. If you generate a new legitimate order with a Payment Authorization taking place on the front end it should post into Magento as "processing" under the order status. In that case it will be picked up by ShipStation. Another option may be to look back at the screenshot I posted and see if you can add your current order status to ShipStation.

That make any sense?

Aloha

You're correct. I just did a real purchase from the frontend and it imports with no issues. That's odd, because the first order was done that way and it showed as pending like the dummy orders. 

Hello I was just wondering if I am missing a step? I tried this as well and am having no such luck. Everything is connected I have added so custom attributes as custom options, flushed cache, tried updating ship station, then done the process over and over changing the custom attributes as custom options and trying again but I'm still not having any luck....

Do you have any errors displaying in Magento admin?

No I have no errors and everything looks to be setup right. Even on Ship Station it is showing that it is connected but no orders are importing. Everything was working great until I updated Magento to the newest 2.4.4 Version.

I've heard that 2.4.4 causes grief with Shipstation... 

It works fine once you get it set up correctly. The developers could certainly have done a better job of preventing the errors which result from bad setups though 

In your install directory, navigate to magento->var->log. In there, you should have a shipping.log file. See if there are any errors in it.

I just look and got 1 order out of around 60 to import to ship station.

 

This was the error that I had in the backend which is above in the thread. I think why it didn't work for me is because not all my products have these custom options..

 

auctane_api.ERROR: Deprecated Functionality: trim(): Passing null to parameter #1 ($string) of type string is deprecated in /chroot/home/a3938f96/fusionfirearms.com/html/vendor/auctane/api/Model/Action/Export.php on line 312 [] []

Update: As of now i added a custom attribute to products called Shipstation just to add something to all my products and still no luck....... and of course ship station hasn't responded in 3 days to any of my questions.....

I found out a bit more about the issues with ShipStation and Magento 2.4. The problem is that PHP 8.1 deprecates passing null to a lot of functions, including the trim() function which is where your issue comes from. Previously, if a variable was null, it would be silently converted to an empty string and you wouldn't get the error. The odd thing here is that it isn't supposed to throw an error until PHP 9. My guess is it's something in Magento that throws an error on certain warnings. Anyway, a temporary fix is to use the null coalescing operator. Open yoursite/html/vendor/auctane/api/Model/Action/Export.php in a text editor and locate line 312.

It will look like this:

 

if (empty(trim($internalNote->getComment()))) continue;

 

Replace it with this:

 

if (empty(trim($internalNote->getComment() ?? ''))) continue;

 

The correct way to fix this is to make a module which overrides the Export.php class, but first I want to see if this is the only error. If it is, I can throw a module together to fix it in about 5 minutes which will get you by until ShipStation gets around to fixing it.

This worked!!! But im not sure why but it would only import the orders from todays date but not any others from previous days.

I really appreciate the help as well. You are helping me more than shipstation!


@TSFUSION wrote:

I really appreciate the help as well. You are helping me more than shipstation!


You're welcome. The thing with customer support is they aren't software developers. When something doesn't work, all they can do is forward the issue to the tech department. Since they don't write their own software, it probably just hits a dead end at that point.

Check the shipping log again and see if there are any new errors. Sometimes we fix one thing, only to find that there's something else that's also broken.

I checked the log and the only errors that I see are for an order a month ago that has already shipped and been fulfilled. Below are the 2 errors

 

auctane_api.ERROR: Not all of your products are available in the requested quantity. [] []

 

auctane_api.ERROR: Shipment can not be created for Order #000032639. Here the reasons: No order item can be sent [] []

 

Not sure if we need to fix anything. Everything else is running through smoothly so far.

The fix we did won't survive an update.

I put a plugin together which will permanently fix this, as well as all of the other issues. I'm just extensively testing it before making it available.


@TSFUSION wrote:

I just look and got 1 order out of around 60 to import to ship station.

 

This was the error that I had in the backend which is above in the thread. I think why it didn't work for me is because not all my products have these custom options..

 

auctane_api.ERROR: Deprecated Functionality: trim(): Passing null to parameter #1 ($string) of type string is deprecated in ~/html/vendor/auctane/api/Model/Action/Export.php on line 312


The error is coming from the getInternalNotes function in Export.php.  That function is looking at the order comment history. You can see that if you view an order, and click Comment History in the sidebar. The issue is the export script is trying to trim whitespace on a null. If an error is thrown, it breaks the script, so the order doesn't export. From the view order information tab, scroll down and try adding a comment to one of the orders and see if it imports it.