Comments (14)
I am experiencing the same issue.
I am not familiar with the code, but this is what is happening:
I am trying to create a product, the baseRequestMessage is the request to create (the POST), but it does a GET request first for some reason.
The API responds successfully, but the json returned has "products" as the root node, not "product", which is what is being sent through:
When deserializing, the node is not found, jToken is null and calling ToObject results in the null ref exception.
from shopifysharp.
I resolved my issue, it was because of Shopify Domains.
I was using the first one, the Primary, when I switched to the other one, it worked. @pmartinciibo do you have multiple domains?
from shopifysharp.
Glad it's working for you guys! Just so I understand the solution, do you mind answering some questions I have if you have time?
- The domain that wasn't working was a
*.myshopify.com
domain?- Using the second URL in ShopifySharp, the one that says it will redirect to a
*.myshopify.com
domain, is the one that actually works?- If they're both
*.myshopify.com
domains, which one was the original one for the store?The one that was not working was my branded, primary domain (E.G., awesomestore.myshopfiy.com). The one that did work was more like a GUID (E.G. fffffff-f.myshopify.com). I don't remember for sure, but I suppose the latter was the original one, and I think I added the custom domain later.
Mine was the exact same, the original DNS was random letters and numbers (which works) and the primary custom domain was added later (which does not work).
from shopifysharp.
Here is the stack trace:
System.NullReferenceException
HResult=0x80004003
Message=Object reference not set to an instance of an object.
Source=ShopifySharp
StackTrace:
at ShopifySharp.Infrastructure.Serializer.DeserializeWithNewtonsoft[T](String json, String rootElementPath, Nullable1 dateParseHandlingOverride) at ShopifySharp.ShopifyService.<>c__DisplayClass25_0
1.<b__0>d.MoveNext()
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at ShopifySharp.DefaultRequestExecutionPolicy.d__01.MoveNext() at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at ShopifySharp.ShopifyService.<ExecuteRequestCoreAsync>d__25
1.MoveNext()
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at ShopifySharp.ShopifyService.d__271.MoveNext() at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at ShopifySharp.ProductService.<CreateAsync>d__5.MoveNext() at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Runtime.CompilerServices.TaskAwaiter
1.GetResult()
at AmazonDsp.Services.Objects.Ivy.Shopify.ShopifyManager.d__39.MoveNext() in C:\Development\AmazonDsp\AmazonDsp.Services.Objects\Ivy\Shopify\ShopifyManager.cs:line 1241
from shopifysharp.
Thanks @pmartinciibo! Would it be possible to debug the request and see if you can get the raw response body? It should be a property on the exception:
try
{
// your code that throws an exception here
}
catch (ShopifyException ex)
{
Console.WriteLine(ex.RawBody);
throw;
}
That should give us the exact string that Shopify is returning, which will give a hint as to what can't be deserialized.
from shopifysharp.
It doesn't look like a ShopifyException is being thrown.
from shopifysharp.
Oh, right, my bad. It's a null reference problem so it won't throw a ShopifyException. We'll need to look at the body before ShopifySharp tries to deserialize it, which is a little tricky. I'm going to write some test code and get back to you!
from shopifysharp.
Sorry this slipped my mind. Thanks a ton @Jason-Powell-Sync! That helps me a lot. You said it's doing a GET request first? That's very strange and should not be happening, but it would explain why "products"
is being returned as the GET request would mean Shopify is returning a list of products.
from shopifysharp.
I'm digging into this further on my side still.
I think it is doing a POST, but getting the GET response back. I am getting the same result on Postman.
from shopifysharp.
This is an issue on the Shopify side. This shows the exact issue I am having:
https://community.shopify.com/c/shopify-scripts/product-post-method-is-returning-status-200-but-don-t-create-a/td-p/2232624
from shopifysharp.
Thanks for investigating, it's unfortunate the person in that forum post never got an answer from Shopify staff. I'd be curious to see the request and response headers if you have them, with your access-token and shop domain redacted. Maybe there's something in there that can clue us in as to what's going on.
from shopifysharp.
Jumping in to second that using the second URL (redirects to ) also worked for me!
from shopifysharp.
Glad it's working for you guys! Just so I understand the solution, do you mind answering some questions I have if you have time?
- The domain that wasn't working was a
*.myshopify.com
domain? - Using the second URL in ShopifySharp, the one that says it will redirect to a
*.myshopify.com
domain, is the one that actually works? - If they're both
*.myshopify.com
domains, which one was the original one for the store?
from shopifysharp.
Glad it's working for you guys! Just so I understand the solution, do you mind answering some questions I have if you have time?
- The domain that wasn't working was a
*.myshopify.com
domain?- Using the second URL in ShopifySharp, the one that says it will redirect to a
*.myshopify.com
domain, is the one that actually works?- If they're both
*.myshopify.com
domains, which one was the original one for the store?
The one that was not working was my branded, primary domain (E.G., awesomestore.myshopfiy.com). The one that did work was more like a GUID (E.G. fffffff-f.myshopify.com). I don't remember for sure, but I suppose the latter was the original one, and I think I added the custom domain later.
from shopifysharp.
Related Issues (20)
- Product Service ListAsync - Not Paging HOT 2
- Deprecated property delivery_category is being used HOT 2
- How to list order by product ? HOT 3
- API get checkout by token not working HOT 6
- Internal application stopped working HOT 2
- Order not coming in api HOT 2
- Adding Multiple Tracking Numbers with Fulfillment.TrackingNumbers HOT 3
- Add read_returns and write_returns to access scopes enums HOT 2
- Customer is not returned by graphql mutation HOT 2
- LeakyBucket does not release the Semaphore if a request fails or the task is canceled
- Missing Alt attribute in ArticleImage class
- HttpResponseMessage Response in RequestResult marked as Obsolete HOT 5
- Add support for IAsyncEnumerable on every service that supports ListAsync
- Add support for validating the timestamp with a default timeout period in `ShopifyRequestValidationUtility`
- IsValidShopDomainAsync should check if shopDomain is a valid uri before building the shop domain uri HOT 2
- Support for Meta Objects? HOT 6
- RefundLineItem SubTotalTaxSet - copypaste issue? HOT 1
- Feature: Generate methods based on .graphql files HOT 1
- OrderRiskService Deprecated / Obsolete HOT 2
- New 'current_quantity' field of order 'line_items'
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from shopifysharp.