newrelic-experimental/gatsby-build-newrelic

Request failed with status code 413

Opened this issue · 8 comments

Description

When running a build locally, this plugin works fine. When running on Gatsby Cloud, I get a 413 error and the build fails.

Relevant Logs / Console output

21:50:59 PM:
ERROR "gatsby-build-newrelic" threw an error while running the onPostBuild lifecycle:

21:50:59 PM:
Request failed with status code 413

21:50:59 PM:
  Error: Request failed with status code 413

21:50:59 PM:
  - createError.js:16 createError

21:50:59 PM:
    [app]/[axios]/lib/core/createError.js:16:15

21:50:59 PM:
  - settle.js:17 settle

21:50:59 PM:
  - http.js:260 IncomingMessage.handleStreamEnd

21:50:59 PM:
    [app]/[axios]/lib/core/settle.js:17:12

21:50:59 PM:
    [app]/[axios]/lib/adapters/http.js:260:11

21:50:59 PM:
  - readable.js:1334 endReadableNT

21:50:59 PM:
    internal/streams/readable.js:1334:12

21:50:59 PM:
  - task_queues.js:82 processTicksAndRejections

21:50:59 PM:
not finished onPostBuild - 249.149s

21:50:59 PM:
    internal/process/task_queues.js:82:21

21:51:02 PM:
info [@] gatsby-build-newrelic: Reduced length of an attribute that was too long: gitAuthor:Author: David Johnson 

21:51:02 PM:
+  Author: BiUser,

21:51:02 PM:
+    documentAuthor,

21:51:02 PM:
+import documentAuthor from "../schemas/documents/documentAuthor"

21:51:02 PM:
+++ b/admin/src/schemas/documents/documentAuthor.js

21:51:02 PM:
+    ...S.Docs({ author: "Authors" }, Icons.Author),

21:51:02 PM:
+  title: "Author",

21:51:02 PM:
diff --git a/admin/src/schemas/documents/documentAuthor.js b/admin/src/schemas/documents/documentAuthor.js

21:51:02 PM:
+      title: "Author",

21:51:02 PM:
+const AuthorWrapper = tw.div`pt-1-6 md:text-center`

21:51:02 PM:
+      title: "Author Photo",

21:51:02 PM:
+      title: "Author",

21:51:02 PM:
+      title: "Author",

21:51:02 PM:
+const AuthorInfo = tw.div`inline-block ml-1-6`

21:51:02 PM:
+const AuthorName = styled(StyledH5)`

21:51:02 PM:
+                

21:51:02 PM:
+                    {section.author}

21:51:02 PM:
+                  

21:51:02 PM:
+                  

21:51:02 PM:
+                

21:51:02 PM:
+ * Author

21:51:02 PM:
+export interface Author extends SanityDocument {

21:51:02 PM:
+   * Author — `string`

21:51:02 PM:
+  author?: SanityReference

21:51:02 PM:
+   * Author — `reference`

21:51:02 PM:
+  | Author

21:51:02 PM:
+   * Displayed as **Authorized**.

21:51:02 PM:
+   * Author — `string`

21:51:02 PM:
+   * Author Photo — `customImage`

21:51:02 PM:
+   * The Authorize.net payment gateway is not enabled.

21:51:02 PM:
+   * Authorize.net did not return any payment methods. Make sure the correct Authorize.net account is linked.

21:51:02 PM:
+   * Authorization code associated with the transaction.

21:51:02 PM:
+  extendedAuthorizationSet?: ShopifyPaymentsExtendedAuthorization

21:51:02 PM:
+export interface ShopifyPaymentsExtendedAuthorization {

21:51:02 PM:
+  standardAuthorizationExpiresAt: DateTime

21:51:02 PM:
+   * Authorization expired.

21:51:02 PM:
+  authorizeNetCustomerPaymentProfile?: RemoteAuthorizeNetCustomerPaymentProfileInput

21:51:02 PM:
+  extendedAuthorizationExpiresAt: DateTime

21:51:02 PM:
+   * The customerPaymentProfileId value from the Authorize.net API.

21:51:02 PM:
+  ShopifyPaymentsExtendedAuthorization?: ShopifyPaymentsExtendedAuthorizationTypeResolver

21:51:02 PM:
+   * The customerProfileId value from the Authorize.net API.

21:51:02 PM:
+export interface RemoteAuthorizeNetCustomerPaymentProfileInput {

21:51:02 PM:
+ * Input for a remote Authorize.net customer payment profile.

21:51:02 PM:
+   * Authorize.net is not enabled for subscriptions.

21:51:02 PM:
+  authorizationCode?: OrderTransactionToAuthorizationCodeResolver

21:51:02 PM:
+export interface OrderTransactionToAuthorizationExpiresAtResolver {

21:51:02 PM:
+export interface OrderTransactionToAuthorizationCodeResolver {

21:51:02 PM:
+  authorizationExpiresAt?: OrderTransactionToAuthorizationExpiresAtResolver

21:51:02 PM:
+export interface ShopifyPaymentsExtendedAuthorizationTypeResolver {

21:51:02 PM:
+  extendedAuthorizationExpiresAt?: ShopifyPaymentsExtendedAuthorizationToExtendedAuthorizationExpiresAtResolver

21:51:02 PM:
+export interface ShopifyPaymentsTransactionSetToExtendedAuthorizationSetResolver {

21:51:02 PM:
+  extendedAuthorizationSet?: ShopifyPaymentsTransactionSetToExtendedAuthorizationSetResolver

21:51:02 PM:
+export interface ShopifyPaymentsExtendedAuthorizationToExtendedAuthorizationExpiresAtResolver {

21:51:02 PM:
+  standardAuthorizationExpiresAt?: ShopifyPaymentsExtendedAuthorizationToStandardAuthorizationExpiresAtResolver

21:51:02 PM:
+  authorizationExpiresAt?: PaymentSessionToAuthorizationExpiresAtResolver

21:51:02 PM:
+export interface ShopifyPaymentsExtendedAuthorizationToStandardAuthorizationExpiresAtResolver {

21:51:02 PM:
+export interface PaymentSessionToAuthorizationExpiresAtResolver {

21:51:02 PM:
+  author: ArticleAuthor

21:51:02 PM:
+  authors: Array

21:51:02 PM:
+   * Displayed as **Authorized**.

21:51:02 PM:
+export interface ArticleAuthor {

21:51:02 PM:
+  author: CommentAuthor

21:51:02 PM:
+  authorV2?: ArticleAuthor

21:51:02 PM:
+  ArticleAuthor?: ArticleAuthorTypeResolver

21:51:02 PM:
+  CommentAuthor?: CommentAuthorTypeResolver

21:51:02 PM:
+export interface CommentAuthor {

21:51:02 PM:
+  author?: ArticleToAuthorResolver

21:51:02 PM:
+  authorV2?: ArticleToAuthorV2Resolver

21:51:02 PM:
+export interface ArticleToAuthorResolver {

21:51:02 PM:
+  authors?: BlogToAuthorsResolver

21:51:02 PM:
+export interface ArticleToAuthorV2Resolver {

21:51:02 PM:
+export interface BlogToAuthorsResolver {

21:51:02 PM:
+export interface ArticleAuthorTypeResolver {

21:51:02 PM:
+  email?: ArticleAuthorToEmailResolver

21:51:02 PM:
+  lastName?: ArticleAuthorToLastNameResolver

21:51:02 PM:
+  bio?: ArticleAuthorToBioResolver

21:51:02 PM:
+  firstName?: ArticleAuthorToFirstNameResolver

21:51:02 PM:
+export interface ArticleAuthorToBioResolver {

21:51:02 PM:
+  name?: ArticleAuthorToNameResolver

21:51:02 PM:
+export interface ArticleAuthorToEmailResolver {

21:51:02 PM:
+export interface ArticleAuthorToFirstNameResolver {

21:51:02 PM:
+export interface ArticleAuthorToLastNameResolver {

21:51:02 PM:
+export interface ArticleAuthorToNameResolver {

21:51:02 PM:
+  author?: CommentToAuthorResolver

21:51:02 PM:
+export interface CommentToAuthorResolver {

21:51:02 PM:
+export interface CommentAuthorTypeResolver {

21:51:02 PM:
+  email?: CommentAuthorToEmailResolver

21:51:02 PM:
+  name?: CommentAuthorToNameResolver

21:51:02 PM:
+##  Author: YY

21:51:02 PM:
+export interface CommentAuthorToNameResolver {

21:51:02 PM:
+##  Author: XX

21:51:02 PM:
+export interface CommentAuthorToEmailResolver {

21:51:02 PM:
+##  Author: XX

21:51:02 PM:
+##  Author: XX & YY

21:51:02 PM:
+##  Author: ZZ

21:51:02 PM:
+##  Author: YY

21:51:02 PM:
+##  Author: YY & XX

21:51:02 PM:
+##  Author: XX

21:51:02 PM:
+##  Author: YY

21:51:02 PM:
+##  Author: XX

21:51:02 PM:
+##  Author: XX

21:51:02 PM:
+##  Author: XX & YY

21:51:03 PM:
info [@] gatsby-build-newrelic: Collecting JS Bundle sizes

21:53:30 PM:
ERROR Failed to compile: Error: Exited with code 1

@struct78 Thanks for reporting this! This project currently doesn't have a dedicated maintainer team as it's experimental, but let me tag a few people that may have some insights into this. @rudouglas / @lazyplatypus 👋

Hi @struct78 apologies for the delay and thanks so much for trying out the plugin. I did see this issue previously, it's related to the length of the attribute being sent to New Relic,in this case it likes like the gitAuthor attribute, though I did introduce a fix for this. Could you confirm which version of the plugin you are using, and if you're not on the latest version 1.1.16 could you update and try retesting?

In the meantime i'll take a look to see if there's any reason that change may not be working correctly, and if there's any additional error logging we can add to give us more info 😸

@rudouglas Thank you for getting back to me, I have been using 1.1.16 :)

Hi @struct78 apologies for the delay here, could you try using this specific test version and see if that fixes the issue?

1.1.16-ru-attribute-length-fix.1

This seems to have been caused by an incorrect calculation in the max attribute length checker :)

@rudouglas Thanks for that, I've updated the plugin to that version, but still getting same response. Is there any other information you need from me?

08:56:15 AM:

info [@] gatsby-build-newrelic: Collecting JS Bundle sizes
08:59:55 AM:

Request failed with status code 413
08:59:55 AM:

error "gatsby-build-newrelic" threw an error while running the onPostBuild lifecycle:
08:59:55 AM:

  Error: Request failed with status code 413
08:59:55 AM:

    [app]/[axios]/lib/core/createError.js:16:15
08:59:55 AM:

  - createError.js:16 createError
08:59:55 AM:

  - settle.js:17 settle
08:59:55 AM:

  - readable.js:1334 endReadableNT
08:59:55 AM:

  - http.js:260 IncomingMessage.handleStreamEnd
08:59:55 AM:

    [app]/[axios]/lib/core/settle.js:17:12
08:59:55 AM:

    [app]/[axios]/lib/adapters/http.js:260:11
08:59:55 AM:

    internal/streams/readable.js:1334:12
08:59:55 AM:

    internal/process/task_queues.js:82:21
08:59:55 AM:

  - task_queues.js:82 processTicksAndRejections
08:59:55 AM:

not finished onPostBuild - 223.169s```

Ok maybe this is related to the JS Bundle sizes event actually, let me do some testing on that, i'll add some more logging so we can tell which step the error is being emitted from

Any update on this? Im experiencing the same error locally.

vai0 commented

I put up a PR for this: #33

It simply gzip's the request payload so there's a higher likelihood it remains under the limit. Not exactly. a permanent fix, but it's probably in a better state than it is now and it works for me