question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Erro ao se conectar na api. Messagem de erro: "You must supply a valid API key"

See original GitHub issue

Criei uma função básica para se conectar ao serviço.

  import { client } from 'pagarme'
  
  export async function connect(apiKey: string | undefined) {
    try {
      console.log(apiKey) // Minha chave api 
      return await client.connect({ api_key: apiKey })
    } catch (error) {
      throw error
    }
  }

Criei também um teste unitário:

import { connect } from '../../src/services/pagarme'
import { env } from '../../src/env'

describe('To connect pagarme', () => {
  it('should to be able return success', async () => {
    const apiKey = env('PAGARME_API_KEY')

    const connected = await connect(apiKey)

    expect(connected).toHaveProperty('acquirers')
  })
})

Formato da chave api gerada na v5: sk_qrezZl4TrZFRb1Vx Formato da chave api gerada na v4: ak_test_grXijQ4GicOa2BLGZrDRTR5qNQxJW0

Quando utilizo a chave api gerada na versão 4 consigo me conectar com sucesso ao serviço e o teste passa, porém utlizando a chave api gerada pela versão 5, é me retornado esse erro: “You must supply a valid API key”

Sinceramente não sei o que estou fazendo de errado

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:2
  • Comments:7

github_iconTop GitHub Comments

2reactions
magnomoreiracommented, Dec 8, 2021

Fala @pcsantana corrigindo. O endereço é esse aqui https://github.com/pagarme/pagarme-core-api-nodejs

2reactions
magnomoreiracommented, Dec 8, 2021

Bom dia galera, tudo bem? Então, nossa SDK pagarme-js integra com a versão 4, para integrar com a versão 5 lançamos uma nova SDK. Criamos essa nova SDK com a junção da Pagarme com a Mundi, que é a pagarme-core-api-nodejs. Caso vocês queiram utilizar essa versão, terão que instalar o pacote referente a nova sdk que é o @pagarme/sdk.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Error: You must supply a valid API key - Stackoverflow
seguinte problema em node: "You must supply a valid API key". Estou iniciando a conexão com esse código: pagarme.client .connect({ api_key: " ...
Read more >
Error Messages | Maps JavaScript API - Google Developers
This page describes the error messages that can be returned by the Maps JavaScript API. The Maps JavaScript API writes error and warning...
Read more >
How do I troubleshoot HTTP 403 errors from API Gateway?
An HTTP 403 response code means that a client is forbidden from accessing a valid URL. The server understands the request, ...
Read more >
Guia de solução de problemas e perguntas frequentes do ...
Esta mensagem de erro é exibida quando o valor do cabeçalho da chave de API fornecido ( x-api-key ) é inválido. Certifique-se de...
Read more >
API Error Codes - Neutrino API Docs
API Error Code HTTP Status Code Error Message 01 400 MISSING OR INVALID PARAMETER 02 400 DAILY API LIMIT EXCEEDED 03 400 INVALID URL
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found