Giter VIP home page Giter VIP logo

Comments (14)

Jason-Powell-Sync avatar Jason-Powell-Sync commented on June 28, 2024 1

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.
image

The API responds successfully, but the json returned has "products" as the root node, not "product", which is what is being sent through:
image

When deserializing, the node is not found, jToken is null and calling ToObject results in the null ref exception.

image

from shopifysharp.

Jason-Powell-Sync avatar Jason-Powell-Sync commented on June 28, 2024 1

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?

image

from shopifysharp.

Jason-Powell-Sync avatar Jason-Powell-Sync commented on June 28, 2024 1

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?

  1. The domain that wasn't working was a *.myshopify.com domain?
  2. Using the second URL in ShopifySharp, the one that says it will redirect to a *.myshopify.com domain, is the one that actually works?
  3. 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.

pmartinciibo avatar pmartinciibo commented on June 28, 2024

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_01.<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__251.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.TaskAwaiter1.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.

nozzlegear avatar nozzlegear commented on June 28, 2024

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.

pmartinciibo avatar pmartinciibo commented on June 28, 2024

It doesn't look like a ShopifyException is being thrown.
Exception

from shopifysharp.

nozzlegear avatar nozzlegear commented on June 28, 2024

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.

nozzlegear avatar nozzlegear commented on June 28, 2024

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.

Jason-Powell-Sync avatar Jason-Powell-Sync commented on June 28, 2024

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.

Jason-Powell-Sync avatar Jason-Powell-Sync commented on June 28, 2024

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.

nozzlegear avatar nozzlegear commented on June 28, 2024

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.

BradMJustice avatar BradMJustice commented on June 28, 2024

Jumping in to second that using the second URL (redirects to ) also worked for me!

from shopifysharp.

nozzlegear avatar nozzlegear commented on June 28, 2024

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?

  1. The domain that wasn't working was a *.myshopify.com domain?
  2. Using the second URL in ShopifySharp, the one that says it will redirect to a *.myshopify.com domain, is the one that actually works?
  3. If they're both *.myshopify.com domains, which one was the original one for the store?

from shopifysharp.

BradMJustice avatar BradMJustice commented on June 28, 2024

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?

  1. The domain that wasn't working was a *.myshopify.com domain?
  2. Using the second URL in ShopifySharp, the one that says it will redirect to a *.myshopify.com domain, is the one that actually works?
  3. 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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.